Difference between revisions of "Json"

From GiderosMobile
(remove language stuff)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
<languages />
 
 
<!-- GIDEROSOBJ:json -->
 
<!-- GIDEROSOBJ:json -->
'''<translate>Supported platforms</translate>:''' [[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/>
+
'''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/>
'''<translate>Available since</translate>:''' Gideros 2013.09<br/>
+
'''Available since:''' Gideros 2013.09<br/>
=== <translate>Description</translate> ===
 
<translate>Provides Lua table serialization and deserialization to and from string in json format</translate>
 
  
=== <translate>Examples</translate> ===
+
=== Description ===
'''Get user's geo:'''<br/>
+
Provides Lua table serialization and deserialization to and from string in json format.
 +
 
 +
=== Example ===
 +
'''Gets user's geolocation'''
 
<source lang="lua">
 
<source lang="lua">
 
require('json')
 
require('json')
Line 20: Line 20:
 
end)
 
end)
 
</source>
 
</source>
 +
 
{|-
 
{|-
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
=== <translate>Methods</translate> ===
+
=== Methods ===
[[Special:MyLanguage/json.decode|json.decode]] ''<translate>Returns Lua table from provided json encoded string</translate>''<br/><!-- GIDEROSMTD:json.decode(jsondata) Returns Lua table from provided json encoded string -->
+
[[json.decode]] ''returns Lua table from provided json encoded string''<br/><!--GIDEROSMTD:json.decode(jsondata) returns Lua table from provided json encoded string-->
[[Special:MyLanguage/json.encode|json.encode]] ''<translate>Returns encoded json string from provided Lua table</translate>''<br/><!-- GIDEROSMTD:json.encode(data) Returns encoded json string from provided Lua table -->
+
[[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;"|
 
| style="width: 50%; vertical-align:top;"|
=== <translate>Events</translate> ===
+
=== Events ===
=== <translate>Constants</translate> ===
+
=== Constants ===
 
|}
 
|}
  
 
{{GIDEROS IMPORTANT LINKS}}
 
{{GIDEROS IMPORTANT LINKS}}

Revision as of 17:13, 16 January 2021

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

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)

Methods

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

Events

Constants