I have been using snowplow scala SDK and Python SDK to convert TSV enriched events into JSON.
Now the issue is that the created JSON is not getting converted back to the Snowplow Event object itself.
In the case of Python SDK -
It basically transforms the TSV event into JSON (check this - https://github.com/snowplow/snowplow/wiki/Python-Analytics-SDK-Event-Transformer#the-json-event-transformer) with flattening the self-describing Json and then this cannot be converted back to snowplow event using the implicit encoder and decoder from scala SDK.
and I didn’t found any method for the same in the python SDK.
Now in case of using Scala-SDK -
The generated JSON is able to convert back to the object if we are not parsing it while flattening the JSON’s.
sample code that I tried -
val snowEvent: Event = Event.parse(page_view_tsv_format).getOrElse(throw new RuntimeException("not able to parse")) println("got the event obejct" + snowEvent) val snowJsonFormat = snowEvent.toJson(lossy = false) println("converted successfully it into json " + snowJsonFormat) **// now converting it back to the Event Object, This will work** val jsonToEvent = parser.decode[Event](snowJsonFormat.toString)
But if in the above example itself if we convert it with
val snowJsonFormat = snowEvent.toJson(lossy = true) and then try to convert it back -
here it gives error -
Left(DecodingFailure(Attempt to decode value on failed cursor, List(DownField(contexts))))