json library get error in last stable release

Hi,

I have an app that I build with 894 release and I’m using the json library to encode - decode data.
It works fine. Also I have stored the require in a local variable.

Now I need to make an update. When I tried to use the last stable release 971, I get an error. The code doesn’t read correct the decode function.

Is something change? I can’t find what is wrong. I also use director class in this project.

thanks a lot

[code] local json = require (“json”)

params.jsonFileW = function( filename, base )
if not base then base = system.ResourceDirectory; end
local path = system.pathForFile( filename, base )
–local contents
local file = io.open( path, “r” )
if file then
local contents = file:read( “*a” )
print( "Contents of " … path … “\n” … contents )
io.close( file )
end
return contents
end

params.xmlW = json.decode( params.jsonFileW( “workbook.json” ) )
print(params.xmlW ) – get nil instead a table
[import]uid: 13028 topic_id: 33315 reply_id: 333315[/import]

The recent changes have made json decoding more strict, previously you could leave off commas etc and it would be fine but now not so much.

I use Json Validator on OSX to check our data, I’m sure there are online tools as well. [import]uid: 119420 topic_id: 33315 reply_id: 132314[/import]

Someone in the IRC pointed me to this site to validate json:

http://jsonlint.com/

[import]uid: 135765 topic_id: 33315 reply_id: 132328[/import]

And the official stuff:

http://www.jsoneditoronline.org

Joakim [import]uid: 81188 topic_id: 33315 reply_id: 132330[/import]

Guys,
thanks a lot! [import]uid: 13028 topic_id: 33315 reply_id: 132403[/import]

The recent changes have made json decoding more strict, previously you could leave off commas etc and it would be fine but now not so much.

I use Json Validator on OSX to check our data, I’m sure there are online tools as well. [import]uid: 119420 topic_id: 33315 reply_id: 132314[/import]

Someone in the IRC pointed me to this site to validate json:

http://jsonlint.com/

[import]uid: 135765 topic_id: 33315 reply_id: 132328[/import]

And the official stuff:

http://www.jsoneditoronline.org

Joakim [import]uid: 81188 topic_id: 33315 reply_id: 132330[/import]

Guys,
thanks a lot! [import]uid: 13028 topic_id: 33315 reply_id: 132403[/import]

Sorry. After posting the message, I’ve got it write. I’m still not sure, what was the problem. I managed to use this tutorials code: http://www.coronalabs.com/blog/2011/08/03/tutorial-exploring-json-usage-in-corona/

[import]uid: 157501 topic_id: 33315 reply_id: 140885[/import]

Sorry. After posting the message, I’ve got it write. I’m still not sure, what was the problem. I managed to use this tutorials code: http://www.coronalabs.com/blog/2011/08/03/tutorial-exploring-json-usage-in-corona/

[import]uid: 157501 topic_id: 33315 reply_id: 140885[/import]