Storing JSON in DB

Hi i need to store json in a db, before stroing the json. I am doing json.stringify() but still when the json comes with special characters like /,= … it stores in the db differently.

Example - this is the json " this is “Emergency App” that will be build etc. etc, : this is et/,"

It will be stored in postgres DB as “{“1”:“this is \“Emergency App\” that will be build etc. etc, : this is et\”/\\\\||/abc”}"

Can you help me, how to make sure it store the json in a proper manner

This is because you are using " " try using or ’ ’

I am storing the json in this format.

{
“ques-1 text”: “ans-1 text”,
“ques-2 text”: “ans-2 text”
}

Can you show me how this looks in db:
{
“ques-1 text”: “ans-1 text”,
“ques-2 text”: “ans-2 text”
}

Hi this is how it looks like in db, in submission column i want to keep the json.

This is how it looks like in submission column

“{“1”:“this is \“Emergency App\” that will be build etc. etc, : this is et\”/\\\\||/abc”}"

Quote in json in ’ ’ and then add to DB
‘{
“ques-1 text”: “ans-1 text”,
“ques-2 text”: “ans-2 text”
}’

Hi shivam, i tried storing it in single quote, but it throws error as internalServer Error

“message”: “Unexpected token ’ in JSON at position 0”

I am passing the submission, via params in the api

can you send me the line where you are passing json to API as params

Hi this is how the api, looks like

http://localhost:5000/api/V1/gamification/student/69501504-8dbf-41e2-bba8-aead17884f69/rewardSubmission?submission=’{“what will you build?” : “this is “Emergency App” that will be build etc. etc, : this is et/,”}’&levelId=1

store all strings in variables and then use variable values in link you can’t pass " " in links.
For example:
http://localhost:5000/api/V1/gamification/student/69501504-8dbf-41e2-bba8-aead17884f69/rewardSubmission?submission={${VariableName1} : ${VariableName2}}&levelId=1

but its a post api, how can i make the submission row into a variable? can you elaborate a bit

var VariableName1=“what will you build?”;
var VariableName2=“this is “Emergency App”;
http://localhost:5000/api/V1/gamification/student/69501504-8dbf-41e2-bba8-aead17884f69/rewardSubmission?submission= {${VariableName1} : ${VariableName2}} &levelId=1

but the problem is for some submision there will two questions for some there will be three questions.
{
“ques-1 text”: “ans-1 text”,
“ques-2 text”: “ans-2 text”


}

And second issue is, as this is a post api, how can i make it variable? as it’s directly coming to me via API. will its help if i pass it via body?

Can you send me the whole code and what you are trying to execute?

Its a public platform i guess, is there any way we can connect via call? is it possible?

Yep you can whatsapp me on 8010098131

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.