Einhugur JSON Plugin III for Xojo

EinhugurJSONIII.JSONDocument Class (console safe)

Class to handle root operations of a JSON message or document.

EinhugurJSONIII.JSONPrimitive
   JSONDocument

class EinhugurJSONIII.JSONDocument

Constructors

JSONDocumentConstructor that takes no parameters.

Properties

BooleanValue (Inherited) Reads or writes Boolean value if the JSONPrimitive is actually Boolean.
DoubleValue (Inherited) Reads or writes Double value if the JSONPrimitive is actually Double.
Int32Value (Inherited) Reads or writes Int32 value if the JSONPrimitive is actually Int32.
Int64Value (Inherited) Reads or writes Int64 value if the JSONPrimitive is actually Int64.
IsArray (Inherited) Returns true if the JSONPrimitive is actually JSON array.
IsBoolean (Inherited) Returns true if the JSONPrimitive is actually Boolean.
IsDouble (Inherited) Returns true if the JSONPrimitive is actually Double.
IsInt (Inherited) Returns true if the JSONPrimitive is actually Integer based (Int32 or Int64).
IsNull (Inherited) Returns true if the JSONPrimitive represents JSON null.
IsNumber (Inherited) Returns true if the JSONPrimitive is actually number.
IsObject (Inherited) Returns true if the JSONPrimitive is actually JSON object.
IsString (Inherited) Returns true if the JSONPrimitive is actually String.
MemberCount (Inherited) Return number of members in the JSON object.
ParserErrorDetailed error for the Parse method.
StringValue (Inherited) Reads or writes String value if the JSONPrimitive is actually String.
Type (Inherited) Returns type code enum value for the JSON primitive.

Methods

AddMember (Inherited) Adds Boolean member to a JSON object.
AddMember (Inherited) Adds Double member to a JSON object.
AddMember (Inherited) Adds JSONPrimitive member to a JSON object.
AddMember (Inherited) Adds Int32 member to a JSON object.
AddMember (Inherited) Adds Int64 member to a JSON object.
AddMember (Inherited) Adds String member to a JSON object.
AsArray (Inherited) Gets JSONArray from the JSONPrimitive if the primitive is actually array.
BooleanValueByKey (Inherited) Gets or Sets Boolean value by key on a JSON object.
BuildSchemaCompiles JSONSchemaDocument from the JSONDocument.
Clone (Inherited) Deep clones the primitive..
CreateArrayCreates JSONArray object for this document.
CreateObjectCreates JSONObject object for this document.
shared DateTimeToISO8601Converts DateTime to ISO-8601 date time which is suitable for JSON.
shared DateToISO8601Converts DateTime to ISO-8601 date which is suitable for JSON.
DoubleValueByKey (Inherited) Gets or Sets Double value by key on a JSON object.
GetSource (Inherited) Gets source for the JSON primitive and all nodes bellow it.
GetValueByPathExecutes JSON Pointer query on the document, returning the result as JSONPrimitive or nil.
HasMember (Inherited) Checks if JSON object has a member by given name.
shared ISO8601ToDateTimeConverts string containing ISO8601 formatted date to DateTime.
Int32ValueByKey (Inherited) Gets or Sets Int32 value by key on a JSON object.
Int64ValueByKey (Inherited) Gets or Sets Int64 value by key on a JSON object.
Operator_Compare (Inherited) Compares the JSON primitive with a JSONprimitive value.
Operator_Compare (Inherited) Compares the JSON primitive with a Boolean value.
Operator_Compare (Inherited) Compares the JSON primitive with a double value.
Operator_Compare (Inherited) Compares the JSON primitive with a Int32 value.
Operator_Compare (Inherited) Compares the JSON primitive with a Int64 value.
Operator_Compare (Inherited) Compares the JSON primitive with a String value.
Operator_Subscript (Inherited) Reads JSON primitive from JSON object by using the Xojo array operator.
ParseParses JSON message, returning true if successful.
RemoveAllMembers (Inherited) Removes all members from the primitive if the primitive is a JSON object.
RemoveMember (Inherited) Removes member by name from JSON object.
SetArray (Inherited) Changes the primitive so it becomes json array.
SetObject (Inherited) Changes the primitive so it becomes json object.
SortKeys (Inherited) Sorts the Keys if the primitive is actually Object.
StringValueByKey (Inherited) Gets or Sets String value by key on a JSON object.

Examples

Creating JSON document with code:

using EinhugurJSONIII

var root as JSONDocument = new JSONDocument()

// By default the documents root is born as null, so we need to define it as Object or Array.
root.SetObject()

var arr as JSONArray = root.CreateArray()
arr.Append(16)
arr.Append(42)
arr.Append(128)

root.AddMember("RootA", "Hello world")
root.AddMember("ArrayOfNumbers", arr)


'// Put the raw source to the edit field
TextArea1.Text = root.GetSource(true)




Reading same document with code:

using EinhugurJSONIII

if TextArea1.Text = "" then
    MessageBox "There is nothing in the textbox"
else
    Dim doc as new JSONDocument()
   
    if doc.Parse(TextArea1.Text) then
      
       if doc.IsObject() then
          MessageBox doc.StringValueByKey("RootA")
       end if
    else
       MessageBox "Error"
    end if
   
   
end if


Supported Platforms:

  • macOS Intel 32 bit
  • macOS Intel 64 bit
  • macOS Apple Silicon
  • Windows 32 bit
  • Windows 64 bit
  • Windows ARM 64 bit
  • Linux 32 bit
  • Linux 64 bit
  • Linux ARM 32 bit
  • Linux ARM 64 bit
  • iOS