https://unrealengine.com/marketplace/ja/slug/easyjsonparser
Usage and sample of EasyJsonParser released in the market place of UE4.
Json string or Json file after loading, specify the access string and get the value.
Specify the path to the value you want to get by connecting dots.
The access string for taking a "prop" value from the following simple Json is prop
.
{
"prop":"abc"
}
If you have a hierarchy as shown below, connect with dots to create an access string.
In the following case, the access string is obj.prop
because we want to take the prop
property in the object obj
.
{
"obj":
{
"prop":"abc"
}
}
In the case of the following array, please specify which array element to use.
For example, if you want to take the second prop
, it will be obj[1].prop
.
If you want to take the first prop
, it will beobj[0].prop
.
{
"obj":[
{
"prop":"abc"
},
{
"prop":"def"
}
]
}
The following four functions are provided to obtain values from Json:
- ReadInt(int)
- ReadFloat(float)
- ReadString(string)
- ReadBool(bool)
Enter the access string for "AccessString".
Enter the default value for "DefaultValue". If the specified value does not exist in Json, a default value is returned.
There are also "ReadObject" and "ReadObjects" methods that get as objects instead of values.
This method can only retrieve object properties.
ReadObject gets one node object.
ReadObjects gets an array of multiple objects.
As shown below, you can use it to get an object in the middle of the hierarchy and then get the properties of that object.