Json

From GiderosMobile
Revision as of 14:28, 13 July 2023 by Hgy29 (talk | contribs) (Text replacement - "<source" to "<syntaxhighlight")

Supported platforms: Platform android.pngPlatform ios.pngPlatform mac.pngPlatform pc.pngPlatform html5.pngPlatform winrt.pngPlatform win32.png
Available since: Gideros 2013.09

Description

Provides Lua table serialization and deserialization to and from string in json format.

Example

Gets user's geolocation <syntaxhighlight lang="lua"> require('json')

local loader = UrlLoader.new("http://ip-api.com/json")

loader:addEventListener(Event.COMPLETE, function(event) local receivedTable=json.decode(event.data) print(receivedTable.countryCode) print(receivedTable.timezone) end) </source>

Methods

json.decode returns Lua table from provided json encoded string
json.encode returns encoded json string from provided Lua table

Events

Constants