I just upgraded to Ruby 5.1.4 and some of my previously working javascript code stopped working and i cant seem to figure out why.
Every time i set the properties of an object like this
FLOW.nodes.forEach( function( node ) {
_nodes.push({
"step_type": node.type,
"internal_id": node.getId({ useMap: useMap }),
"step_attributes" : {
"shape": node.shape,
"icon": node.icon,
"title": node.title,
"subtitle": node.subTitle,
"connectors": JSON.stringify( node.connectors ),
"tags": JSON.stringify( node.tags ),
"allowed_connections": JSON.stringify( node.allowedConnections ),
"position": JSON.stringify( node.position ),
"configured": node.configured,
"socket": JSON.stringify( node.socket ),
"buttons": JSON.stringify( node.buttons ),
"color": node.color
},
"properties": JSON.stringify( FLOW.getNodeProperties( node.getId() ) )
});
});
every-time i save it keeps adding more backslashes to properties and i cant figure out why
here is what it prints out like
"properties": "\"{\\\"tags\\\": \\\"erewerwre\\\",\\\"tagged_present\\\": true,\\\"tagged_future\\\": false,\\\"tagged_present_future\\\": false,\\\"remove_from_other_flows\\\": false}\""
If it runs through there again it will keep adding more backslashes.
any idea how i can fix this?
stringifyinside of JavaScript? This will, obviously, create duplicate quotes. You're working with a JavaScript object directly. The quotes on the keys are extraneous, this isn't JSON data. It's JavaScript data.