Reputation: 981
I have a javascript object as :
service location : Object
formatted_address:"Jharkhand, India"
latitude : "23.6101808"
longitude :"85.2799354"
How can I insert this in a single column
as object in my sqlite database.
I want to receive this column value as an object in my response when I execute SELECT query on my database.
Upvotes: 1
Views: 1181
Reputation: 167172
You can convert it into JSON String and send it.
JSON.stringify({
service_location: {
formatted_address: "Jharkhand, India",
latitude: "23.6101808",
longitude: "85.2799354"
}
});
This will be converted into:
{"service_location":{"formatted_address":"Jharkhand, India","latitude":"23.6101808","longitude":"85.2799354"}}
And this can be safely decoded using:
JSON.parse('{"service_location":{"formatted_address":"Jharkhand, India","latitude":"23.6101808","longitude":"85.2799354"}}');
Upvotes: 2