S
S
semki0962016-05-08 12:25:20
JSON
semki096, 2016-05-08 12:25:20

How to manipulate JSON, and are there any tools for this purpose?

How to manipulate JSON , and are there any tools for this purpose? For example a JSON array. Each array element has a value - a string and a position value in the string. Accordingly, I need to display these elements line by line. What is the best way to do this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Iron Bug, 2016-05-08
@semki096

Use serializers. For any YP, there are a dozen different ones for every taste and color.
Here is an example for c#, www.newtonsoft.com/json/help/html/QueryJsonDynamic.htm

string json = @"[
   {
     'Title': 'Json.NET is awesome!',
     'Author': {
       'Name': 'James Newton-King',
       'Twitter': '@JamesNK',
       'Picture': '/jamesnk.png'
     },
     'Date': '2013-01-23T19:30:00',
    'BodyHtml': '<h3>Title!</h3>\r\n<p>Content!</p>'
  }
]";
dynamic blogPosts = JArray.Parse(json);
dynamic blogPost = blogPosts[0];
string title = blogPost.Title;
Console.WriteLine(title);
string author = blogPost.Author.Name;
Console.WriteLine(author);
DateTime postDate = blogPost.Date;
Console.WriteLine(postDate);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question