Json: Difference between revisions
From GiderosMobile
Created page with "__NOTOC__ '''Supported platforms:''' <br/> '''Available since:''' Gideros 2013.09<br/> === Description === Provides Lua table serialization and deserialization to and from str..." |
m Text replacement - "</source>" to "</syntaxhighlight>" |
||
| (19 intermediate revisions by 3 users not shown) | |||
| Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
'''Supported platforms:''' <br/> | <!-- GIDEROSOBJ:json --> | ||
'''Supported platforms:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform mac.png]][[File:Platform pc.png]][[File:Platform html5.png]][[File:Platform winrt.png]][[File:Platform win32.png]]<br/> | |||
'''Available since:''' Gideros 2013.09<br/> | '''Available since:''' Gideros 2013.09<br/> | ||
=== Description === | === Description === | ||
Provides Lua table serialization and deserialization to and from string in json format{|- | Provides Lua table serialization and deserialization to and from string in json format. | ||
| style="width: 50%;"| | |||
=== 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) | |||
</syntaxhighlight> | |||
{|- | |||
| style="width: 50%; vertical-align:top;"| | |||
=== Methods === | === Methods === | ||
| style="width: 50%;"| | [[json.decode]] ''returns Lua table from provided json encoded string''<br/><!--GIDEROSMTD:json.decode(jsondata) returns Lua table from provided json encoded string--> | ||
[[json.encode]] ''returns encoded json string from provided Lua table''<br/><!--GIDEROSMTD:json.encode(data) returns encoded json string from provided Lua table--> | |||
| style="width: 50%; vertical-align:top;"| | |||
=== Events === | === Events === | ||
=== Constants === | === Constants === | ||
|} | |} | ||
{{GIDEROS IMPORTANT LINKS}} | |||
Latest revision as of 13:30, 13 July 2023
Supported platforms: ![]()
![]()
![]()
![]()
![]()
![]()
![]()
Available since: Gideros 2013.09
Description
Provides Lua table serialization and deserialization to and from string in json format.
Example
Gets user's geolocation
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)
Methodsjson.decode returns Lua table from provided json encoded string |
EventsConstants |