JsonParserParseJson(String) Method

Parse the given JSON.

Definition

Namespace: MichaelBrooks.UK.Json
Assembly: JsonDOM (in JsonDOM.dll) Version: 1.0.7
C#
public static JsonNode ParseJson(
	string jsonDocument
)

Parameters

jsonDocument  String
The JSON to be parsed.

Return Value

JsonNode
A parse tree or document object model (DOM), populated with JsonNode objects.

Remarks

Sets the default reaction by the JsonNode.Item(String) operators so as to throw an exception when attempting to retrieve the member of a JSON object by name when multiple members have the same name.
Online page.

Example

C#
String businessDataFilePath = Directory.GetCurrentDirectory() + @"\Example1.json";
String json = File.ReadAllText(businessDataFilePath);   // Throws FileNotFoundException if file does not exist
JsonNode jsonDOM = JsonParser.ParseJson(json);

Exceptions

ArgumentExceptionThrown if content of jsonDocument is not valid JSON.

See Also