title: How to export Titan graph data to a JSON file?
body: <p>I am trying to export Titan graph data to a JSON file using below code</p>
  
  <pre><code>TitanGraph titanGraph = TitanFactory.open("D:/Dev/Titan/titan-1.0.0-hadoop1/conf/titan-cassandra.properties");
  FileOutputStream outJSON = new FileOutputStream("D:/titan-graph.json");
  GraphSONWriter.build().create().writeGraph(outJSON, titanGraph);
  </code></pre>
  
  <p>While running this code getting Exception:</p>
  
  <pre><code>Exception in thread "main" com.fasterxml.jackson.databind.JsonMappingException: (was java.lang.IllegalStateException) (through reference chain: com.thinkaurelius.titan.graphdb.relations.RelationIdentifier["inVertexId"])
      at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:210)
      at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:177)
      at com.fasterxml.jackson.databind.ser.std.StdSerializer.wrapAndThrow(StdSerializer.java:187)
      at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:647)
      at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:152)
      at org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONUtil.writeWithType(GraphSONUtil.java:49)
      at org.apache.tinkerpop.gremlin.structure.util.star.StarGraphGraphSONSerializer.ser(StarGraphGraphSONSerializer.java:100)
      at org.apache.tinkerpop.gremlin.structure.util.star.StarGraphGraphSONSerializer.serialize(StarGraphGraphSONSerializer.java:64)
      at org.apache.tinkerpop.gremlin.structure.util.star.StarGraphGraphSONSerializer.serialize(StarGraphGraphSONSerializer.java:54)
      at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:128)
      at com.fasterxml.jackson.databind.ObjectMapper._configAndWriteValue(ObjectMapper.java:2881)
      at com.fasterxml.jackson.databind.ObjectMapper.writeValue(ObjectMapper.java:2304)
      at org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONWriter.writeVertex(GraphSONWriter.java:76)
      at org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONWriter.writeVertices(GraphSONWriter.java:104)
      at org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONWriter.writeGraph(GraphSONWriter.java:65)
      at com.mimos.titan.TitanGraphTest.main(TitanGraphTest.java:29)
  Caused by: java.lang.IllegalStateException
      at com.google.common.base.Preconditions.checkState(Preconditions.java:158)
      at com.thinkaurelius.titan.graphdb.relations.RelationIdentifier.getInVertexId(RelationIdentifier.java:69)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:466)
      at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:639)
      ... 12 more
  </code></pre>