Gremlin queries containing Nested Objects & Apostrophes
I'm getting into GraphDB and I've just started making use of Gremlin alongside NeptuneDB to build a demo application.
I've been running into an issue for a while now, first is:
- I'm sending data to the Neptune DB that contains Nested Objects / Array of Nested Objects, what's the better way to run a Gremlin query that creates a property with the objects therein?
What I've had to do is write an algorithm that checks if i'm sending objects, then I stringify the object before sending,
Then whenever I'm receiving back the data, I parse the values from the keys
Secondly: How can I escape the apostrophe in my strings " ' "? I know of using the forward slashes \'...but this doesn't work accurately when I have nested JSON. Or different data structures across my request body
P:S - I'm a beginner with GraphDB and would appreciate references to using Gremlin/NeptuneDB as well as there aren't enough documentation out there
![](https://cdn.answeroverflow.com/1113883312323301457/Screenshot_2023-06-01_at_18.29.32.png)
2 Replies
Neptune (as is the case for many graphs) do not support storage of complex objects. If you must store them then converting to JSON (or binary for some graphs) is probably the only way you can do that. The limitation of course to storing complex objects this way is that their contents aren't easily searchable with Gremlin. as for the apostrophe, you would need to double escape them essentially - here i do it with double quotes, but you could do the same with apostrophe:
"{\"thing\": {\"a\": \"x\\\"\"}}"
Thank you so much ! @spmallette