Я хочу получить значение текста в« источнике »: {« id »: с JSON из этого текста JSon:jointjs: я хочу получить значение источника »: {« id »: from json text
{
"cells":
[
{
"type": "devs.Model", "size": { "width": 40, "height": 40 },
"inPorts": [""], "outPorts": [""], "position": { "x": 103, "y": 345 },
"angle": 0, "id": "4a8edbca-dd9d-4164-bf0a-fc4cbffdca86", "z": 1,
"attrs": {
".label": { "text": "aa", "ref-x": 0.4, "ref-y": 0.2 },
"rect": { "fill": "#2ECC71" },
".inPorts circle": { "fill": "#16A085", "magnet": "active", "type": "input" },
".outPorts circle": { "fill": "#E74C3C", "type": "output" },
".inPorts>.port0>.port-label": { "text": "" },
".inPorts>.port0>.port-body": { "port": { "id": "in8", "type": "in" } },
".inPorts>.port0": { "ref": ".body", "ref-y": 0.5 },
".outPorts>.port0>.port-label": { "text": "" },
".outPorts>.port0>.port-body": {
"port": { "id": "out9", "type": "out" }
},
".outPorts>.port0": { "ref": ".body", "ref-y": 0.5, "ref-dx": 0 }
}
},
{
"type": "link", "source": {}, "target": {}, "id": "35173392-8b69-44fc-b6f4-f7c8a62319bb", "z": 2, "attrs": {}
},
{
"type": "devs.Model", "size": { "width": 40, "height": 40 },
"inPorts": [""], "outPorts": [""], "position": { "x": 603, "y": 488 },
"angle": 0, "id": "39e8bc7f-0553-4c5a-b198-b948b0905ae7", "z": 3,
"attrs": {
".label": { "text": "aaa", "ref-x": 0.4, "ref-y": 0.2 },
"rect": { "fill": "#2ECC71" },
".inPorts circle": { "fill": "#16A085", "magnet": "active", "type": "input" },
".outPorts circle": { "fill": "#E74C3C", "type": "output" },
".inPorts>.port0>.port-label": { "text": "" },
".inPorts>.port0>.port-body": { "port": { "id": "in15", "type": "in" } },
".inPorts>.port0": { "ref": ".body", "ref-y": 0.5 },
".outPorts>.port0>.port-label": { "text": "" },
".outPorts>.port0>.port-body": { "port": { "id": "out16", "type": "out" } },
".outPorts>.port0": { "ref": ".body", "ref-y": 0.5, "ref-dx": 0 }
}
},
{
"type": "link", "source": { "id": "4a8edbca-dd9d-4164-bf0a-fc4cbffdca86", "selector": "g:nth-child(1) g:nth-child(4) g:nth-child(1) circle:nth-child(1) ", "port": "out9" },
"target": { "id": "39e8bc7f-0553-4c5a-b198-b948b0905ae7", "selector": "g:nth-child(1) g:nth-child(3) g:nth-child(1) circle:nth-child(1) ", "port": "in15" },
"id": "19bfe3a0-bb48-4665-8f2b-807c3bc33451", "embeds": "", "z": 4,
"attrs": { ".marker-target": { "d": "M 10 0 L 0 5 L 10 10 z" } }
}]
}
я сделать
var t = JSON.stringify(graph)+"";
var obj = jQuery.parseJSON(t);
alert(obj.cells[3].source['.id']);
, но он не работает
несмотря если я не stringify я не получаю значение \t на другой стороне я могу получить значение метки, когда я делать предупреждение (OBJ. cells [0] .attrs ['. label']. текст); –