how can i store this kind of coordinate to json. and read into table for use?

how can i store this kind of coordinate to json. and read into table for use?

[code]
local path1={
[1]={x=348,y=117},
[2]={x=348,y=136},
[3]={x=348,y=148},
[4]={x=348,y=160},
[5]={x=348,y=174},
[6]={x=348,y=183},
[7]={x=348,y=193},
[8]={x=348,y=201},
[9]={x=348,y=210},
[10]={x=348,y=222},
[11]={x=348,y=234},
[12]={x=348,y=240},
[13]={x=348,y=250}}

local path2={
[1]={x=298,y=147},
[2]={x=310,y=137},
[3]={x=323,y=130},
[4]={x=338,y=126},
[5]={x=354,y=123},
[6]={x=367,y=126},
[7]={x=378,y=132},
[8]={x=385,y=141},
[9]={x=387,y=150},
[10]={x=384,y=160},
[11]={x=379,y=168},
[12]={x=370,y=174},
[13]={x=360,y=181},
[14]={x=348,y=186},
[15]={x=336,y=192},
[16]={x=326,y=198},
[17]={x=316,y=206},
[18]={x=308,y=215},
[19]={x=303,y=224},
[20]={x=301,y=232},
[21]={x=310,y=239},
[22]={x=321,y=239},
[23]={x=334,y=240},
[24]={x=348,y=240},
[25]={x=359,y=240},
[26]={x=371,y=240},
[27]={x=382,y=240}}

[import]uid: 22631 topic_id: 21675 reply_id: 321675[/import]

did you try the json.encode and json.decode methods? [import]uid: 3826 topic_id: 21675 reply_id: 85976[/import]

i tried it before, but not success. maybe my coding problems [import]uid: 22631 topic_id: 21675 reply_id: 85981[/import]

You have to make json array like:

{
“path1”:[
{“x”:348,“y”:117},
{“x”:348,“y”:136},
{“x”:348,“y”:148},
{“x”:348,“y”:160},
{“x”:348,“y”:174},
{“x”:348,“y”:183},
{“x”:348,“y”:193},
{“x”:348,“y”:201},
{“x”:348,“y”:210},
{“x”:348,“y”:222},
{“x”:348,“y”:234},
{“x”:348,“y”:240},
{“x”:348,“y”:250}
]
}

and you have to use json.decode function for that.

http://developer.anscamobile.com/reference/index/jsondecode

Thanks,
Ahesanali [import]uid: 9664 topic_id: 21675 reply_id: 86003[/import]

hi Ahesanali, thanks!
[import]uid: 22631 topic_id: 21675 reply_id: 86007[/import]