I figured out the solution , the solution to storing JSON Object is as follows: I converted the Json object to json string. I stored the string in one of the vertex as its property.
Then when i wanted the value, i got back the value from the vertex in the form of a string. Then i converted it into JSON Object using Json serializing method. Plus if you want the Object as some object of specific class, you will need to use GSON library to convert JSON object to some specific object. Hope this helps anyone :) On Wednesday, 10 June 2015 00:52:19 UTC+5:30, Craig Trader wrote: > > Nandan ... > > The Graph API is overlaid on top of the ODocument APIs. For any > OrientElement (ie: OrientVertex, OrientEdge), you can call getRecord() to > get the backing ODocument object. If you look at the ODocument class, > there is a much wider selection of methods for moving data to and from JSON > text. > > Note, JSON is a text data format, with many library implementations that > will provide APIs to process text and produce Java objects. While Orient > does provide the Jackson 2.2.X jars with their distribution, those APIs are > largely used internally and are not incorporated into Orient's public API. > Orient can't be expected to support every Java JSON implementation, when > the JSON standard describes the text format and not internal binary > representations. > > - Craig - > > On Mon, Jun 8, 2015 at 7:47 AM, nandan parikh <[email protected] > <javascript:>> wrote: > >> I tried storing the JSON object as string and it works fine. >> But storing as a JSON object as object itself shows serialization error. >> >> Code : >> >> Vertex v = graph.addVertex(null); >> JSONObject json = new JSONObject(); >> >> json.put("name","someone"); >> json.put("address","somewhere"); >> >> v.setProperty("data", json); >> ( v.setProperty("data",json.toString() --- this works fine ) >> >> This code shows serialization error.. Cannot serialize JSONObject! >> >> Any method to store JSON Objects as Objects without converting to string? >> >> Thanks. >> >> -- >> >> --- >> You received this message because you are subscribed to the Google Groups >> "OrientDB" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- --- You received this message because you are subscribed to the Google Groups "OrientDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
