title: How to store json content to CosmosDB with CreateDocumentAsync
body: <p>TARGET: Create Console Application, which 1) Read json from Azure Data Lake Store 2) Store data to Cosmos DB as json. (In next step I will parse json contents in code before storing)</p>
  
  <p>PROBLEM: New Document is created in CosmosDB, but it contains some kind of meta data instead of actual json file content. String json do include content I need, but it is not passed correctly to CreateDocumentAsync. I would appreciate help with fixing issue and also appreciate tips to make code easy to handle json.</p>
  
  <p>ERROR: No error messages, but wrong content is stored to CosmosDB.</p>
  
  <p>CODE:</p>
  
  <pre><code>private  async Task CreateDocumentsAsync()
      {
          string fileName = "/myjson.json";
  
          // Obtain AAD token for ADLS 
          var creds = new ClientCredential(applicationId, clientSecret);
          var clientCreds = ApplicationTokenProvider.LoginSilentAsync(tenantId, creds).GetAwaiter().GetResult();
  
          // Create ADLS client object
          AdlsClient client = AdlsClient.CreateClient(adlsAccountFQDN, clientCreds);
  
          String json = "";
  
          //Read file contents
          using (var readStream = new StreamReader(client.GetReadStream(fileName)))
          {
              string line;
              while ((line = readStream.ReadLine()) != null)
              {
                  Console.WriteLine("Read file Line: " + line);
                  json += line;
              }
          }
  
          //Read file to json
          JsonTextReader reader = new JsonTextReader(new StringReader(json));
  
          //Storing json to CosmosDB
          Uri collectionUri = UriFactory.CreateDocumentCollectionUri(databaseName, collectionName);
  
          using (DocumentClient DocumentDBclient2 = new DocumentClient(new Uri(endpointUrl), authorizationKey))
          {
              Document doc = await DocumentDBclient2.CreateDocumentAsync(collectionUri, reader);
  
          }
      }
  
  }
  </code></pre>
  
  <p>JSON SAMPLE(I want to store this):</p>
  
  <pre><code>[
  {
      color: "red",
      value: "#f00"
  },
  {
      color: "green",
      value: "#0f0"
  },
  {
      color: "blue",
      value: "#00f"
  },
  {
      color: "cyan",
      value: "#0ff"
  },
  {
      color: "magenta",
      value: "#f0f"
  },
  {
      color: "yellow",
      value: "#ff0"
  },
  {
      color: "black",
      value: "#000"
  }
  ]
  </code></pre>
  
  <p>JSON STORED TO COSMOSDB:</p>
  
  <pre><code>{
  "ArrayPool": null,
  "LineNumber": 0,
  "LinePosition": 0,
  "CloseInput": true,
  "SupportMultipleContent": false,
  "QuoteChar": "\u0000",
  "DateTimeZoneHandling": 3,
  "DateParseHandling": 1,
  "FloatParseHandling": 0,
  "DateFormatString": null,
  "MaxDepth": null,
  "TokenType": 0,
  "Value": null,
  "ValueType": null,
  "Depth": 0,
  "Path": "",
  "Culture": "(Default)",
  "id": "0189f287-b6ae-4e45-95b8-879293d4c8f3",
  "_rid": "nDxrAL1JbwYIAAAAAAAAAA==",
  "_self": "dbs/nDxrAA==/colls/nDxrAL1JbwY=/docs/nDxrAL1JbwYIAAAAAAAAAA==/",
  "_etag": "\"00006cc5-0000-0000-0000-5a633c900000\"",
  "_attachments": "attachments/",
  "_ts": 1516453008
  }
  </code></pre>