简体   繁体   中英

Azure Cosmos DB upload JSON file via C#/.net

I am looking for a way to upload a JSON file directly to my Azure Cosmos DB container. I am aware of the "classic" way doing it like:

  • load the JSON file
  • convert it via JsonConvert.DeserializeObject<List<Item>>(data) ;
  • upload it like " container.CreateItemAsync(item) "

I would like to skip the part where I have to deserialize the JSON and convert it into a C# object.

Is there a method or way like this?

container.CreateItemAsync(myData.json)

With the Cosmos DB SQL API v3 .NET SDK, there is a stream option which will allow already serialized payloads to be passed in container.CreateItemStreamAsync()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM