json convert code example
Example 1: c# json convert
jsonString = File.ReadAllText(fileName);
weatherForecast = JsonSerializer.Deserialize<WeatherForecast>(jsonString);
Example 2: online json viewer
Online JSON beautifier: https://codebeautify.org/jsonviewer
JSON pretty print in Python:
import json
your_json = '["foo", {"bar":["baz", null, 1.0, 2]}]'
parsed = json.loads(your_json)
print(json.dumps(parsed, indent=4, sort_keys=True))
Example 3: convert json to object
Jackson Data-bind depdendency that take care of
Converting between
JSON to Java Object
and
Java Object to JSON
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.12.0</version>
</dependency>