How remove curly braces {} from all string of a json

Hi, i’ve a huge JSON that contains data like this

{“caseFolderId”:"{2854EE70-146A-4618-826C-BA33FC807A25}",“caseTaskId”:"{28BE9F56-A7D7-4CA5-B777-A51FF3847236}",“stepName”:“Item details”,“columns”:{“DV_NAMECL_POS_ODA”:“Tieleman Transport BV”,“DV_MATNR_TXZ01_POS_ODA”:“445811 - EUROPRENE SBR 1500 GUC BOX 1110 P150 - 1”,“F_StepName”:“Item details”,“DV_Caseidentifier_for_eni_OdA”:null,“DV_MENGE_MEINS_POS_ODA”:“20.000 - KG”,“DV_PEINH_POS”:“1000 - KG”,“DV_NETPR_WAERS_POS_ODA”:“1.000 - EUR”,“DV_EINDT_ODA”:“2015/11/28”,“DV_EBELP_ODA”:“00010”},“DV_Caseidentifier_for_eni_OdA”:null,“DV_EBELP_ODA”:“00010”,“DV_EINDT_ODA”:“2015/11/28”,“DV_MATNR_TXZ01_POS_ODA”:“445811 - EUROPRENE SBR 1500 GUC BOX 1110 P150 - 1”,“DV_NAMECL_POS_ODA”:“Tieleman Transport BV”,“DV_NETPR_WAERS_POS_ODA”:“1.000 - EUR”,“DV_PEINH_POS”:“1000 - KG”,“DV_MENGE_MEINS_POS_ODA”:“20.000 - KG”}

how can i remove curly braces {} from all string of the json

You could use a regular expression replace:

var jsonString = '{"caseFolderId":"{2854EE70-146A-4618-826C-BA33FC807A25}","caseTaskId":"{28BE9F56-A7D7-4CA5-B777-A51FF3847236}","stepName":"Item details","columns":{"DV_NAMECL_POS_ODA":"Tieleman Transport BV","DV_MATNR_TXZ01_POS_ODA":"445811 - EUROPRENE SBR 1500 GUC BOX 1110 P150 - 1","F_StepName":"Item details","DV_Caseidentifier_for_eni_OdA":null,"DV_MENGE_MEINS_POS_ODA":"20.000 - KG","DV_PEINH_POS":"1000 - KG","DV_NETPR_WAERS_POS_ODA":"1.000 - EUR","DV_EINDT_ODA":"2015/11/28","DV_EBELP_ODA":"00010"},"DV_Caseidentifier_for_eni_OdA":null,"DV_EBELP_ODA":"00010","DV_EINDT_ODA":"2015/11/28","DV_MATNR_TXZ01_POS_ODA":"445811 - EUROPRENE SBR 1500 GUC BOX 1110 P150 - 1","DV_NAMECL_POS_ODA":"Tieleman Transport BV","DV_NETPR_WAERS_POS_ODA":"1.000 - EUR","DV_PEINH_POS":"1000 - KG","DV_MENGE_MEINS_POS_ODA":"20.000 - KG"}';
jsonString = jsonString.replace(/("{|}")/gi,'"');
console.log(jsonString);
2 Likes

thank you so much i’ll try

i have this code
the object came from an http request and it’s a json file

for(var i=0;i<response.queueElements.length;i++){
var newObject = {
//forse togliere elementi e columns
//elementi:response.queueElements[i],
caseFolderId:response.queueElements[i].caseFolderId,
caseTaskId:response.queueElements[i].caseTaskId,
stepName:response.queueElements[i].stepName,
columns:response.queueElements[i].columns,
DV_Caseidentifier_for_eni_OdA: response.queueElements[i].columns.DV_Caseidentifier_for_eni_OdA,
DV_EBELP_ODA: response.queueElements[i].columns.DV_EBELP_ODA,
DV_EINDT_ODA: response.queueElements[i].columns.DV_EINDT_ODA,
DV_MATNR_TXZ01_POS_ODA: response.queueElements[i].columns.DV_MATNR_TXZ01_POS_ODA,
DV_NAMECL_POS_ODA: response.queueElements[i].columns.DV_NAMECL_POS_ODA,
DV_NETPR_WAERS_POS_ODA: response.queueElements[i].columns.DV_NETPR_WAERS_POS_ODA,
DV_PEINH_POS: response.queueElements[i].columns.DV_PEINH_POS,
DV_MENGE_MEINS_POS_ODA: response.queueElements[i].columns.DV_MENGE_MEINS_POS_ODA
};
newArray.push(newObject);
//console.log("nuovo oggetto " + newObject);
console.log("dettaglio " + newObject.DV_MENGE_MEINS_POS_ODA + " " + newObject.stepName + " " + newObject.DV_EINDT_ODA);

//anche qui ho tutto il JSON
$rootScope.newObjectJSON.push(JSON.stringify(newObject));
console.log("rootScope.newObjectJSON " + $rootScope.newObjectJSON);
// $rootScope.newObjectJSON = JSON.stringify(newObject);

//DA TESTARE
jsonString = $rootScope.newObjectJSON;
jsonStringArray = jsonString.replace(/("{|}")/gi,’"’);

console.log("senza parentesi "+jsonStringArray);

thee log say
TypeError: Object [object Array] has no method ‘replace’

any suggestion? Thanks

Look at my example… I was running the replace on a string… you’re trying to run it on an array…

and it’s not possible???how can i do? or I can i do instead!!! maybe put in the db in the correct way??