🧩 JSON text created in my project shows as invalid

Hello Community,

I’m working on a project where I’m trying to generate JSON text within the app.
There’s no file save or download function added —
I’m just creating the JSON as plain text.

However, when I check the generated text in a JSON validator,
it shows as invalid JSON.

I want to know —
how can I create a proper and valid JSON structure in my project?
What is the correct way to build it through blocks?

Please guide me :folded_hands:

Thanks!

Aia
json_add.aia (102.4 KB)

Hi pravin,

Dictionary? :grin:

1 Like

to understand better

1 Like

No, I want to create a json data structure in a proper way, which is valid, like

[
{
“id”: 1,
“text”: “दिवस थकवणारा असेल, पण प्रयत्नांचा अर्थ हरवत नाही,\nस्वप्नं थोडी थांबतात, पण कधीच मरत नाहीत,\nउद्याचा पहाट नवा प्रकाश घेऊन येईल.”
},
{
“id”: 2,
“text”: “चंद्रमामा आणि तारे तुला सांगत आहेत की, ‘सगळा थकवा विसरून जा आणि आता फक्त आराम कर.’ उद्या भेटू.”
}
]

But I am getting ready.

[{“id”:1,“text”:" दिवस थकवणारा असेल, पण प्रयत्नांचा अर्थ हरवत नाही,\nस्वप्नं थोडी थांबतात, पण कधीच मरत नाहीत,\nउद्याचा पहाट नवा प्रकाश घेऊन येईल.\n \n “} {“id”:2,“text”:”\n​चंद्रमामा आणि तारे तुला सांगत आहेत की, ‘सगळा थकवा विसरून जा आणि आता फक्त आराम कर.’ उद्या भेटू. \n "} {“id”:3,“text”:"थकलेले हात थोडे थांबू दे,\nकारण उद्या पुन्हा काही घडणार आहे,\nआशेचा दिवा मनात जळू दे. "} {“id”:4,“text”:"ल रात्र सांगते – \n’थोडं थांब, पण थांबून राहू नको\n’,\nथकलेला प्रवासीही पुन्हा चालतोच,\nउद्याची वाट नव्या आशेने उजळलेली आहे. "} {“id”:5,“text”:"डोकं उशीवर ठेवलं की विचारांनाही विसावा मिळतो,\nत्या निळ्या शांततेत मन हळूच हरवतं,\nअशी निवांत झोप म्हणजे स्वर्गासारखी वाटते. "}]

Do you mean that it’s generated on a single line?

1 Like

Yes, and when I checked it, this error occurred.
Comma ‘,’ expected after value but got ‘{’ at line 1 column 173

you’re getting this error

on this?

I just tried your project now, but I’m not getting any errors.

1 Like

Hi @Boby_Sing

How you geting json data? from local assets or an url?

If url, I have an extension. Using that you can call each and every data in List/Grid view.

Here’s data : https://securebugs.pythonanywhere.com/api/Brocode_Memes

And I’m calling data in my app: https://play.google.com/store/apps/details?id=com.twinkthakur18.brocodes

If You want to do something like this let me know.

2 Likes