Ballerina API Documentation

Functions of ballerina.lang.jsons package

function getKeys(json j) (string[] )

Returns an array of keys contained in the specified JSON.

Parameters:

Parameter NameData TypeDescription
jjsonA JSON object

Return Parameters:

Return VariableData TypeDescription
string[]string[]: A string array of keys contained in the specified JSON

function parse(string jsonStr) (json )

Parses the string argument as a JSON value.

Parameters:

Parameter NameData TypeDescription
jsonStrstringString representation of JSON

Return Parameters:

Return VariableData TypeDescription
jsonParsed JSON value

function remove(json j, string key)

Removes each element that matches the given key.

Parameters:

Parameter NameData TypeDescription
jjsonA JSON object
keystringKey of the field to remove

function toString(json j) (string )

Converts a JSON object to a string representation

Parameters:

Parameter NameData TypeDescription
jjsonA JSON object

Return Parameters:

Return VariableData TypeDescription
stringString value of the converted JSON

function toXML(json j, Options options) (xml )

Converts a JSON object to a XML representation

Parameters:

Parameter NameData TypeDescription
jjsonA JSON object
optionsOptionsj: A JSON object

Return Parameters:

Return VariableData TypeDescription
xmlXML value of the converted JSON


Structs of ballerina.lang.jsons package

struct Options

Fields:

Field NameData TypeDescription
attributePrefixstring
arrayEntryTagstring


Menu

  • Functions
    • getKeys(json j) (string[] )
    • parse(string jsonStr) (json )
    • remove(json j, string key)
    • toString(json j) (string )
    • toXML(json j, Options options) (xml )
  • Structs
    • Options

Copyright 2017 Ballerina API Documentation