Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
switched to native json, does not work — Gideros Forum

switched to native json, does not work

edited November 2013 in General questions
The native json is seemly very buggy, perfectly valid json files generate all sorts of stupid errors.

For example this:

{
"en":{
"test_string":"this is a test string",
"test_string2":"this is a test string"
},
"pt":{"test_string":"como vai você?"},
"fr":{"test_string":"je ne parle pas francais"}
}

results in Expected object key string but found T_OBJ_BEGIN at character 4 (T_OBJ_BEGIN in is a enum that means '{')

this file IS valid, and should have worked, but it does not.

Anyone know a way to fix it? (ie: a hack on my json file, or a hack on the json library...)
I make games for children: http://www.kidoteca.com

Comments

  • @speeder_kidoteca really?

    Because this works perfectly for me:
    local testString = '{"en":{"test_string":"this is a test string","test_string2":"this is a test string"},"pt":{"test_string":"como vai você?"}, "fr":{"test_string":"je ne parle pas francais"}}'
    local testTable = json.decode(testString)
    print_r(testTable)
    output:
    [en] => Table {
        {
          [test_string] => this is a test string
          [test_string2] => this is a test string
        }
    [fr] => Table {
        {
          [test_string] => je ne parle pas francais
        }
    [pt] => Table {
        {
          [test_string] => como vai você?
        }
    #-o
  • Sorry =D

    I found out the issue was in (several) other files.
    It is extra commas, the native json hate them (but other json parsers I tested don't care).

    Likes: ar2rsawseen

    I make games for children: http://www.kidoteca.com
    +1 -1 (+1 / -0 )Share on Facebook
Sign In or Register to comment.