gulthor/grex — pull request #40 by alexbeyn (2014-07-22 12:39:00+00:00)
Title: Handle nested objects in GremlinFunction#stringifyArgument

GremlinFunction#stringifyArguments converts objects to maps by just replacing the open and the first close curly braces with the equivalent square brackets when converting to Groovy. This doesn't work for nested objects, and for values with close curly braces.

For example:

Before:

> g.addVertex({name: {first: 'John', last: 'Doe'}}).methods;
[ '.addVertex(["name":{"first":"John","last":"Doe"]})' ]
> g.addVertex({curlyLeft: '{', curlyRight: '}'}).methods;
[ '.addVertex(["curlyLeft":"{","curlyRight":"]"})' ]

After:

> g.addVertex({name: {first: 'John', last: 'Doe'}}).methods;
[ '.addVertex(["name":["first":"John","last":"Doe"]])' ]
> g.addVertex({curlyLeft: '{', curlyRight: '}'}).methods;
[ '.addVertex(["curlyLeft":"{","curlyRight":"}"])' ]