Outputing JSON table value as TEXT....

Hello,

I just wanted to ask how can I display JSON table value as a string. I have set up my own code but it gives an error.

This is my code-

local loadsave = require("loadsave") keys = loadsave.loadTable("keys.json") local keyvalue = keys.amount local keyText = display.newText("KEYS: "..tostring(keyvalue),"siglet",30) keyText.x = 100 keyText.y = 100

And it gives out the following error-

Bad argument #2 to ‘newText’ (number expected, got string)

Someone please help me out.

THANK YOU IN ADVANCE :slight_smile:

I think, in this case, the .newText() API is looking for additional arguments which you aren’t passing to it. Check the single-line example and try to adapt it to your usecase, and see if that works.

THANK YOU SO MUCH IT REALLY WORKED! IMA DUMB :stuck_out_tongue:

I think, in this case, the .newText() API is looking for additional arguments which you aren’t passing to it. Check the single-line example and try to adapt it to your usecase, and see if that works.

THANK YOU SO MUCH IT REALLY WORKED! IMA DUMB :stuck_out_tongue: