Giter Site home page Giter Site logo

Comments (6)

julianpeeters avatar julianpeeters commented on July 28, 2024

Hi Amit,
This library is most useful in conjunction with a schema-parsing library, and even then the mapping one chooses is fairly arbitrary. If you'd like to share a little more about why you need case classes, and why you need to generate them at runtime, I'd be happy to help further.

I think you may be looking for json2caseclass

It will complain that your data can't be easily represented in Scala because the type that parameterizes the result field is heterogeneous:

pseudocode:

case class Result(result: List[List[Last24Hrs], List[Max24Hrs]...])
...

The best you can do without restructuring your data (or exploring Shapeless' HLists) is:

case class Result(result: List[Any])
...

from case-class-generator.

amitprasadom avatar amitprasadom commented on July 28, 2024

mate i have already used . but in current json they are some data without parent key . so there only i am getting problem . i will appreciate you much if you will create case class for above json .

from case-class-generator.

amitprasadom avatar amitprasadom commented on July 28, 2024

any way i used
case class Ticker(result1:List[List[Last24Hrs],List[Max24HrChild],List[Min24HrChild],List[LastTradeMaster]])
giving me an error saying
wrong number of type arguments for List, should be 1
which is obvious

from case-class-generator.

julianpeeters avatar julianpeeters commented on July 28, 2024

yes, but that is how the your json is structured.

You could try case class Ticker(result: List[Any])

Or else investigate how to use Shapeless' Hlists

from case-class-generator.

amitprasadom avatar amitprasadom commented on July 28, 2024

if i will use Any, how would i pass the parameters as a case class in List

from case-class-generator.

julianpeeters avatar julianpeeters commented on July 28, 2024

Without using Shapeless, the best route would be to restructure your data. If that is not possible, then Any is top-level, so every case class is an Any. This loses a lot of type-safety, but it will compile. If you need, you can always cast using .asInstanceOf[Last24Hrs] for example.

from case-class-generator.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.