UtilJsonConvertToXDocument Method
Converts a JSON String to XDocument.
Namespace: DevCase.Core.DataProcessing.JsonAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
public static XDocument ConvertToXDocument(
string json,
Encoding enc
)
Public Shared Function ConvertToXDocument (
json As String,
enc As Encoding
) As XDocument
Dim json As String
Dim enc As Encoding
Dim returnValue As XDocument
returnValue = UtilJson.ConvertToXDocument(json,
enc)
public:
static XDocument^ ConvertToXDocument(
String^ json,
Encoding^ enc
)
static member ConvertToXDocument :
json : string *
enc : Encoding -> XDocument
No code example is currently available or this language may not be supported.
- json String
-
The source JSON string.
- enc Encoding
-
The character encoding that must be used to read the JSON string.
XDocument
The resulting
XDocument.
This is a code example.
No code example is currently available or this language may not be supported.
Dim json As String = <a>
{
"colorsArray":[{
"colorName":"red",
"hexValue":"#f00"
},
{
"colorName":"green",
"hexValue":"#0f0"
},
{
"colorName":"blue",
"hexValue":"#00f"
},
{
"colorName":"cyan",
"hexValue":"#0ff"
},
{
"colorName":"magenta",
"hexValue":"#f0f"
},
{
"colorName":"yellow",
"hexValue":"#ff0"
},
{
"colorName":"black",
"hexValue":"#000"
}
]
}</a>.Value
Dim xdoc As XDocument = ConvertToXDocument(json, Encoding.UTF8)
Dim firstColorName As String = xdoc.Root.<colorsArray>.<item>(0).<colorName>.Value
Dim firsHexValue As String = xdoc.Root.<colorsArray>.<item>(0).<hexValue>.Value
Console.WriteLine(String.Format("Color Name: {0}; Hex. Value: {1}", firstColorName, firsHexValue))
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.