Json Deserializer for Alusus Language
Json Deserializer for Alusus Language
import "Srl/Console.alusus"
import "Apm.alusus"
Apm.importFile("xlmnxp/Json");
def jsonObject: Json = "{\"glossary\": {\"title\": \"example glossary\",\"GlossDiv\": {\"title\": \"S\", \"GlossList\": {\"GlossEntry\": {\"ID\": \"SGML\", \"SortAs\": \"SGML\", \"GlossTerm\": \"Standard Generalized Markup Language\", \"Acronym\": \"SGML\", \"Abbrev\": \"ISO 8879:1986\", \"GlossDef\": {\"para\": \"A meta-markup language, used to create markup languages such as DocBook.\",\"GlossSeeAlso\": [\"GML\", \"XML\"]}, \"GlossSee\": \"markup\"}}}}}";
Srl.Console.print(jsonObject.getObject("glossary").getObject("GlossDiv").getObject("GlossList").getObject("GlossEntry").getObject("GlossDef").getObject("GlossSeeAlso").getString(1)); // output: XML
initialize Type with parse JSON from String
return value of key as String with Quotations
Json.get(key: Int): String
return value of index as String with Quotations
Json.getString(key: ptr[Array[Char]]): String
return value of key as String without Quotations
Json.getString(key: Int): String
return value of index as String without Quotations
Json.getInt(key: ptr[Array[Char]]): Int
return value of key as Int
Json.getInt(key: Int): Int
return value of index as Int
Json.getFloat(key: ptr[Array[Char]]): Float
return value of key as Float
Json.getFloat(key: Int): Float
return value of index as Float
Json.getBool(key: ptr[Array[Char]]): Bool
return value of key as Boolean
Json.getBool(key: Int): Bool
return value of index as Boolean
Json.getObject(key: ptr[Array[Char]]): Json
return value of key as new Json
Json.getObject(key: Int): Json
return value of index as new Json
Json.isObject(): Bool
return true only when json is Object
return true only when json is Array
Json.getLength(): Int
return length of Children
Json.hasQuotes(stringWithQuotes: String): Bool
def jsonObject: Json = "{lang: 'alusus'}"
def str: String = "{lang: 'alusus'}"
def jsonObject: Json = str
MIT LICENSE.