Note that there are some explanatory texts on larger screens.

plurals
  1. POAngularjs - JSON object editing
    text
    copied!<p>I am pretty good at using existing data but I am not an expert on editing JSON objects quite yet so a little help here would do a lot for me. For all I know this could be a rudimentary question but I am asking because I don't know.</p> <p>How would I update a value in JSON string that looks like below? It is a kineticjs object that I need to disable draggable elements in before I re-generate the stage.</p> <p>I created a fiddle based on some input below but I am not successful at it: <a href="http://jsfiddle.net/8Y6zZ/5/" rel="nofollow">http://jsfiddle.net/8Y6zZ/5/</a></p> <p>For example, I would like to set <code>"draggable": false,</code> wherever I have <code>"draggable": true,</code> ... How could I do that with javascript (I am working in angularjs).</p> <pre><code>{ "attrs": { "width": 1276, "height": 660 }, "className": "Stage", "children": [ { "attrs": {}, "className": "Layer", "children": [ { "attrs": { "x": 0, "y": 0, "draggable": false, "name": "brochure-1.png" }, "className": "Image" }, { "attrs": { "x": 999, "y": 288, "draggable": true, "name": "sample1.png", "rotation": 0, "scaleX": 1, "scaleY": 1, "offsetX": 0, "offsetY": 0, "skewX": 0, "skewY": 0 }, "className": "Image" }, { "attrs": { "x": 301, "y": 115, "draggable": true, "name": "sample2.png", "rotation": 0, "scaleX": 1, "scaleY": 1, "offsetX": 0, "offsetY": 0, "skewX": 0, "skewY": 0 }, "className": "Image" } ] } ] } </code></pre> <p>Related to this question,, are there good ways to re-building JSON objects from "basic" JSON... I guess what I am asking is this... if a developer on the back end has no good way to translate data and they pass a badly organized JSON object, is there a way to manipulate the object to restructure it so it can be used well in angularjs..</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload