Table of Contents

Class JSONLibrary

Namespace
NominalSystems.Universe
Assembly
NominalSystems.Universe.dll

[Nominal] This is a helper library that is able to create JSON objects and intepret them using Strings. This is useful for the Unreal applications for handling JSON objects with strings instead.


public static class JSONLibrary
Inheritance
JSONLibrary

Methods

Create(string[], string[])

Creates a new empty JSON set with a specific set of keys and a matching parameter set in the values. This will create a JSON object.

public static string Create(string[] keys, string[] values)

Parameters

keys string[]

The array of keys to add to the object

values string[]

The array of values to add to the associated keys

Returns

string

The JSON object in the form of a string

DeleteKey(string, string)

Deletes a particular key property from a JSON string and returns the new JSON without the property existing.

public static string DeleteKey(string json, string key)

Parameters

json string

The initial JSON data

key string

The key to delete from the JSON

Returns

string

The final JSON with the data deleted

DeleteKeys(string, params string[])

Deletes a number of properties from a JSON string and returns the new JSON without any of the keys existing.

public static string DeleteKeys(string json, params string[] keys)

Parameters

json string

The initial JSON data

keys string[]

The array of keys that should be deleted

Returns

string

The final JSON data string with the keys deleted

GetKeys(string)

Returns the keys of a JSON object as an array of strings. The keys are in the order that they exist within the object.

public static string[] GetKeys(string json)

Parameters

json string

The initial JSON data

Returns

string[]

A list of keys from the JSON object.

GetValue(string, string, bool)

Returns a JSON value or dictionary as a particular type from a JSON string object. This takes in a key as a parameter and whether the key is case sensitive. Additionally, the key can include '.' for nested keys in the JSON.

public static JToken? GetValue(string json, string key, bool caseSensitive = false)

Parameters

json string

The initial JSON data as a string

key string

The key to search for

caseSensitive bool

A flag whether the key is case sensitive

Returns

JToken

A JSON value from the initial JSON data

IsKeyValid(string, string)

Returns whether a particular key exists within some JSON data. This will also be able to check for nested keys using the '.' character.

public static bool IsKeyValid(string json, string key)

Parameters

json string

The initial JSON data

key string

The key to search for

Returns

bool

A key exists flag

IsValid(string)

Returns whether some JSON data is valid. If all data within the JSON string are valid, then this will return true.

public static bool IsValid(string json)

Parameters

json string

The initial JSON data

Returns

bool

A valid JSON data flag

SetValue(string, string, object)

Attempts to set a particular value in a JSON string to an object value as parsed in. This also works with sub-objects by using the '.' separator.

public static string SetValue(string json, string key, object value)

Parameters

json string

The JSON value as a string

key string

The key to set or add to the JSON object

value object

The object to add to the parameter

Returns

string

The updated JSON value as from the JSON data as a string

ToXML(string)

Converts some JSON string into an XML string with all of the parameters from the JSON file. This will correctly convert the data to an XML system and return the string value of the XML.

public static string ToXML(string json)

Parameters

json string

The initial JSON data

Returns

string

An XML string from the JSON