correct way to store screen coords (display.contentWidth*0.5) in a json file

I’m using data files in the json format as explained by JB’s excellent (but very brief) blog post.

How do I store screen coords like display.contentWidth*0.5

if I use “” around the values the json file is parsed OK but I get an error when using the values, something similar to ‘number expected, string given’ e.g.

{“companyFont”:{“native.systemFontBold”,16,{250,255,255},“display.contentWidth*0.5”,“display.contentHeight*0.025”}}

if I omit the quotes (as below) the json file isn’t parsed correctly

{“companyFont”:{“native.systemFontBold”,16,{250,255,255},display.contentWidth*0.5,display.contentHeight*0.025}}

I’m also getting a similar issue trying to handle nil values, if I use quotes then the values aren’t being treated as nil.

{ “companyLogo”:“nil”} or {“companyLogo”:nil} to make the lua table companyLogo = nil

The only solution I can think of is to create the data I need in a LUA table in the code, then encode into json and the upload to my server. So I’d be writing a separate app to create my data sets, one solution but not exactly what I’m after.

I know this maybe a bit obtuse but someone with more json experience may be able to help show the way. Thanks

[import]uid: 137150 topic_id: 34556 reply_id: 334556[/import]

If you want to store something like display.contentWidth*0.5, it’s usually computed (to a number) and then stored. I don’t believe you can store / load equations/code to be processed later with Corona…

If you want to store virtual coordinates, so they translate to the same position on other devices, you could use coronas built in content coordinate system (content scaling). Alternatively but in the same virtual vein, you could just store the factor (0.5 in this case), and then always multiply by the current device display.contentWidth when reading it back. [import]uid: 79933 topic_id: 34556 reply_id: 137405[/import]

I see why it doesn’t work. Storing the scaling factors e.g. 0.5 seems like the best solution, and will saving typing in the long run, I just didn’t want to admit to ‘failure’ in case there was another solution or trickk when using json files.
Thanks for the input, appreciate it [import]uid: 137150 topic_id: 34556 reply_id: 137480[/import]

If you want to store something like display.contentWidth*0.5, it’s usually computed (to a number) and then stored. I don’t believe you can store / load equations/code to be processed later with Corona…

If you want to store virtual coordinates, so they translate to the same position on other devices, you could use coronas built in content coordinate system (content scaling). Alternatively but in the same virtual vein, you could just store the factor (0.5 in this case), and then always multiply by the current device display.contentWidth when reading it back. [import]uid: 79933 topic_id: 34556 reply_id: 137405[/import]

I see why it doesn’t work. Storing the scaling factors e.g. 0.5 seems like the best solution, and will saving typing in the long run, I just didn’t want to admit to ‘failure’ in case there was another solution or trickk when using json files.
Thanks for the input, appreciate it [import]uid: 137150 topic_id: 34556 reply_id: 137480[/import]