Stopbyte

What’s the best way to parse Json file in WinRT/UWP application using C#?

Hi,

What is the best way to parse Json files and text in WinRT/UWP application?
I need to read & write Json files in my UWP Windows Store App.

1 Like

You can use Windows.Data.Json namespace to read/write & parse json files.

You can use the classes JsonValue & JsonObject like this:

JsonValue jsonValue = JsonValue.Parse(JsonString);
String PropertyValue = jsonValue.GetObject().GetNamedString("KeyName");

JsonString: Being the JSON string to parse (it can be some string you read from an external file).
KeyName: The JSON property key name.
PropertyValue: The value of the property with the given key name.

2 Likes