Hello i want a json object without 2 quotes the current output is not valid. How i can make this ?
I want exactly this:
{"format":{"id":"ivf","author":"","title":"","copyright":"","comment":"","album":"","year":"","track":"","genre":""}}
This is the Bad Output not Valid Json:
{"format":"{"id":"ivf","author":"","title":"","copyright":"","comment":"","album":"","year":"","track":"","genre":""}"}
video_format_serialized Data:
{"id":"ivf","author":"","title":"","copyright":"","comment":"","album":"","year":"","track":"","genre":""}
video_format_serialized = JSON.stringify($('#addprofile_FORM_video_format').serializeObject());
alert(video_format_serialized);
var format_object = {
format:video_format_serialized
};
console.log(format_object);
var string = JSON.stringify(format_object);
tring.substring(1);
string.substring(0, string.length-1);
console.log(string);
string = string.replace(/\\/g, "");
console.log(string);
UPDATE Here is the right code to make valid output.
var format_object = {
format:$('#addprofile_FORM_video_format').serializeObject()
};
console.log(format_object);
var string = JSON.stringify(format_object);
string.substring(1);
string.substring(0, string.length-1);
console.log(string);
string = string.replace(/\\/g, "");
console.log(string);