question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JSON to scala case class will produce weird case classes

See original GitHub issue

In the example at https://transform.now.sh/json-to-scala-case-class, it translates a JSON array to a Scala Array. Unfortunately, Scala Array is just a wrapper for Java arrays, which have reference equality. That means that equality between case class instances produced using this tool will not have sensible equality (because distinct arrays containing the same elements will be considered different).

A simple solution would be to switch Array to Seq or IndexedSeq, which will have sensible equality.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
copumpkincommented, Sep 6, 2017

Thank you for the quick response!

1reaction
ritz078commented, Sep 6, 2017

fix is live.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Scala: Parse JSON directly into a case class - Stack Overflow
Given a string of JSON, and a case ...
Read more >
Generate Scala Case Classes From JSON Schema - Medium
Case Class Generator can transform advanced JSON schemas into nested case classes with bunch of configuration settings.
Read more >
How to create a simple Scala object from a JSON String
You need to convert a JSON string into a simple Scala object, such as a Scala case class that has no collections.
Read more >
Re: Is it possible to serialize / deserialize case classes without ...
I want to serialize case classes to json. ... Using this approach I have to define a protocol for each class which is...
Read more >
9. Objects, Case Classes, and Traits - Learning Scala [Book]
Neither of these function types are well suited to being class methods because they have little to do with a class's fields. As...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found