JSON to Scala code generation

953 views Asked by At

I have a JSON which is an output of another application, I want to make dynamic Scala code (*.scala file ) from this JSON (can not pre define class/bean as the JSON structure depends many other parameters). Is there any API available for this ?

2

There are 2 answers

2
ashwinsakthi On
0
HHH On

Please have a look at this one: https://github.com/julianpeeters/case-class-generator

Allows runtime data to serve as Scala case class definitions:

Case classes defined and loaded at runtime Pseudo Type-Provider via type alias

And also this one: Maybe this one is better, you need to generate some code first, and then call it.

http://yefremov.net/blog/scala-code-generation/