UtilJsonConvertToXElement Method
Converts a JSON String to XElement.
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 XElement ConvertToXElement(
string json,
Encoding enc
)
Public Shared Function ConvertToXElement (
json As String,
enc As Encoding
) As XElement
Dim json As String
Dim enc As Encoding
Dim returnValue As XElement
returnValue = UtilJson.ConvertToXElement(json,
enc)
public:
static XElement^ ConvertToXElement(
String^ json,
Encoding^ enc
)
static member ConvertToXElement :
json : string *
enc : Encoding -> XElement
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.
XElement
The resulting
XElement.
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 xml As XElement = ConvertToXElement(json, Encoding.UTF8)
Dim firstColorName As String = xml.<colorsArray>.<item>(0).<colorName>.Value
Dim firsHexValue As String = xml.<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.