Hi,
I want to convert incoming data to Avro and JSON (and later Parquet). Avro conversion is working okay, but JSON conversion throws the following error that I don’t understand: Exception in thread "main" java.lang.RuntimeException: Not the Json schema: {"type":"record","name":"Torperf","namespace":"converTor.torperf","fields":[{"name":"descriptor_type","type":"string","default":"torperf 1.0"}, [ … omitted for brevity …] {"name":"circ_id","type":["null","int"],"doc":"metrics-lib/TorperfResult: int getCircId()"},{"name":"used_by","type":["null","int"],"doc":"metrics-lib/TorperfResult: int getUsedBy()"}],"aliases":["torperfResult"]} at org.apache.avro.data.Json$ObjectWriter.setSchema(Json.java:117) at converTor.WriterObject.<init>(WriterObject.java:116) at converTor.TypeWriter.get(TypeWriter.java:31) at converTor.ConverTor.main(ConverTor.java:249) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) … but that schema is indeed the schema that I want to use. This is a snippet of my code: File schemaFile = new File("schema/jsonSchema.avsc"); Schema.Parser parser = new Schema.Parser(); Schema mySchema = parser.parse(schemaFile) ; Json.ObjectWriter jsonDatumWriter = new Json.ObjectWriter(); jsonDatumWriter.setSchema(mySchema); OutputStream out = new FileOutputStream(outputFile); Encoder encoder = EncoderFactory.get().jsonEncoder(mySchema, out); Can somebody give me a hint? Thanks, Thomas