JsonParserParseJson(String, JsonNodeUnexpectedDuplicateSiblingReaction) 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,
	JsonNodeUnexpectedDuplicateSiblingReaction unexpectedDuplicateSiblingReaction
)

Parameters

jsonDocument  String
The JSON to be parsed.
unexpectedDuplicateSiblingReaction  JsonNodeUnexpectedDuplicateSiblingReaction
How the JsonNode.Item(String) operators should react when attempting to retrieve the member of a JSON object by name when multiple members have that same name.

Return Value

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

Remarks

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, JsonNode.UnexpectedDuplicateSiblingReaction.First);

Exceptions

ArgumentExceptionThrown if content of jsonDocument is not valid JSON.

See Also