A
A
Alexey2021-07-24 21:51:07
JSON
Alexey, 2021-07-24 21:51:07

How to format Json object when serialized to file?

Hi, I'm having difficulty serializing to a Json file, all text goes to a string, how do I categorize it line by line? Library - Newtonsoft.Json
I would be grateful for a good example.


More or less like this:

[
{
    "Enabled": true,
    "Point": {
      "MIP": "0.0.0.0",
      "AuthServerIP": "12.112.121.21",
      "AuthServerPort": 922
    }
}
]

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vasily Bannikov, 2021-07-25
@vabka

JsonConvert.SerializeObject(parsedJson, Formatting.Indented);

edward_freedom

G
GavriKos, 2021-07-24
@GavriKos

Well, you would bring the code, which converts the object into a string. And also the library used ...
But usually there is a minify or Prettyfy flag - look at them

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question