R
R
Roman_sh2019-01-23 12:35:28
ASP.NET
Roman_sh, 2019-01-23 12:35:28

Asp.net core How to extract data from third party json?

Good afternoon everyone.
I had to modify the old C# project a little, asp.net core. Unable to retrieve data from third party query request. Tried a lot of ways

using System;
using Newtonsoft.Json;
using System.Reflection;
using System.Web.Script.Serialization;
using System.IO;

var reader = new StreamReader(Request.InputStream);
string json = reader.ReadToEnd();

var dict = JsonConvert.DeserializeObject(json);

If I just send the received json to the log as a string, then I see the required json object, but I can’t parse it normally
using (StreamWriter sw = System.IO.File.CreateText(logPath))
        {
            sw.WriteLine(dict.GetType().GetProperties().ToString()); // System.Reflection.PropertyInfo[]
        }

How can I parse into an array or extract data one by one from an object?
Should there be simpler ways? no third party libraries

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question