The next version 7.2 of gml4gtk viewer can generate jgf json graph data as defined at this site http://jsongraphformat.info/ "Detailing the specification of the standard JSON Graph Format for Network data interchange"

To see the graph layout of jgf json graph data in the browser try it here at jgf4web

 The reason to take a closer look at this jgf json format is that is has standard support in javascript using json parser and other languages too then it is a easy interface to many languages and tools.

Also dot can generate json graph data which is easier to use then the xdot format.

In the gml4gtk output the dot record/html labels are not yet supported and the node name is used.

The gml, dot and vcg graph data can be saved as jgf json as a converter of these languages to json.

This is example gml graph:

 

 

# this is a comment line
# colors in nodes/edges using 'fill'
# background color of a node is set using `fill'
# border color of a node is set using `outline'
# edge line color is set using `fill'
graph [
  directed 1
  node [ id 0 label "n0" graphics [ fill "#f00000" ] ]
  node [ id 1 label "n1" graphics [ outline "#ff0000" fill "#00ff00" ] ]
  node [ id 2 label "n2" graphics [ outline "#00ff00" fill "#f0ff00" ] ]
  node [ id 3 label "n3" graphics [ outline "#0000ff" fill "#f08000" ] ]
  node [ id 4 label "n4" graphics [ fill "#f0000f" ] ]
  node [ id 5 label "n5" graphics [ outline "#f0000f" fill "#ffffff" ] ]
  edge [ source 4 target 0 graphics [ fill "#f000ff" ] ]
  edge [ source 0 target 1 label "foo" graphics [ fill "#0f0ff0" ] ]
  edge [ source 1 target 2 graphics [ fill "#abf000" ] ]
  edge [ source 2 target 3 graphics [ fill "#f0f000" ] ]
  edge [ source 3 target 0 graphics [ fill "#f000f0" ] ]
  edge [ source 3 target 0 graphics [ fill "#ff000b" ] ]
  edge [ source 5 target 0 graphics [ fill "#ff000b" ] ]
]

Then this is the resulting jgf json:


{
  "graph": {
    "id": "",
    "type": "schema test",
    "label": "gml4gtk",
    "nodes": {
      "0": {
        "label": "n0"
      },
      "1": {
        "label": "n1"
      },
      "2": {
        "label": "n2"
      },
      "3": {
        "label": "n3"
      },
      "4": {
        "label": "n4"
      },
      "5": {
        "label": "n5"
      }
    },
    "edges": [
      {
        "source": "4",
        "target": "0",
        "relation": "edge"
      },
      {
        "source": "0",
        "target": "1",
        "label": "foo",
        "relation": "edge"
      },
      {
        "source": "1",
        "target": "2",
        "relation": "edge"
      },
      {
        "source": "2",
        "target": "3",
        "relation": "edge"
      },
      {
        "source": "3",
        "target": "0",
        "relation": "edge"
      },
      {
        "source": "3",
        "target": "0",
        "relation": "edge"
      },
      {
        "source": "5",
        "target": "0",
        "relation": "edge"
      }
    ],
    "metadata": {}
  }
}

And it looks like:
jgf

and because json is easy to parse it is easy to extend current input format support for tools or to rewrite the data in other format or xml.

Also existing tools can be easier using dot json instead of xdot format.

The clang newest compiler has support for json data output to use with gml4gtk.

And came across this problem when trying to parse gml in javascript which internally used a json format.

The next version of gml4gtk will be at https://sourceforge.net/projects/gml4gtk/

There is a javascript spring embedder graph visualization tool visualgraphx using sfg graph data at https://gitlab.com/comptrans/VisualGraphX/   which should work with the gml4gtk jgf data.

" VisualGraphX has been written in JavaScript and utilizes the d3.js library for the interactive graph visualization"

And it has a python script to convert cif to jgf data at https://toolshed.g2.bx.psu.edu/repository?repository_id=15a6add958eae279&changeset_revision=723b5adb91e4

visualgraph

The d3js example is here in jsongraph.d3-master/index.html

parsing json can also have difficulties accurated described here at jsonparsers.pdf
http://seriot.ch/parsing_json.php
There is even a bash sh json parser at https://github.com/dominictarr/JSON.sh/
This is a good regexp

JSON_VALIDATOR_RE = /(
    # define subtypes and build up the json syntax, BNF-grammar-style
    # The {0} is a hack to simply define them as named groups here but not match on them yet
    # I added some atomic grouping to prevent catastrophic backtracking on invalid inputs
    (?<number>  -?(?=[1-9]|0(?!d))d+(.d+)?([eE][+-]?d+)?){0}
    (?<boolean> true | false | null ){0}
    (?<string>  " (?>[^"\\]* | \\ ["\\bfnrt/] | \\ u [0-9a-f]{4} )* " ){0}
    (?<array>   [ (?> g<json> (?: , g<json> )* )? s* ] ){0}
    (?<pair>    s* g<string> s* : g<json> ){0}
    (?<object>  { (?> g<pair> (?: , g<pair> )* )? s* } ){0}
    (?<json>    s* (?> g<number> | g<boolean> | g<string> | g<array> | g<object> ) s* ){0}