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.

Inconsistent PrettyPrinting

See original GitHub issue
scala> val rawJson = """{"hello": "world", "age": 42, "nested": { "deeper": { "treasure": true }}}"""
rawJson: String = {"hello": "world", "age": 42, "nested": { "deeper": { "treasure": true }}}

scala> rawJson.asJson.noSpaces
res24: String = "{\"hello\": \"world\", \"age\": 42, \"nested\": { \"deeper\": { \"treasure\": true }}}"

scala> decode[HelloWorld](rawJson).map(_.asJson.noSpaces).getOrElse("")
res25: String = {"hello":"world","age":42,"nested":{"deeper":{"treasure":true}}}

res24 is not parsable because of ""

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
dk14commented, Apr 14, 2016

To be more precise. I can “parse” res24, but I still can’t decode it to a case class. And I actually can’t work with it:

scala> parse(res24).getOrElse(Null).hcursor.downField("hello").withFocus(_.mapString(_.reverse)).top
res61: Option[io.circe.Json] = None

Compare to res25:

scala> parse(res25).getOrElse(Null).hcursor.downField("hello").withFocus(_.mapString(_.reverse)).top
res62: Option[io.circe.Json] =
Some({
  "hello" : "dlrow",
  "age" : 42,
  "nested" : {
    "deeper" : {
      "treasure" : true
    }
  }
})

I’m pretty sure it’s a bug!

0reactions
dk14commented, Apr 14, 2016

Ok, now I understand, sorry for trying to force it as a bug 😃.

As I understand, you’ve meant not getting a Json String back - you mean I’ll get a io.circe.Json.JString back. I just didn’t read it careful enough.

Thanks, and sorry again 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - gdb pretty printing inconsistency - Stack Overflow
I'm trying to figure out an inconsistency in the gdb pretty printing. Consider the following short program: #include <map> int main(int argc, char*...
Read more >
Prettyprinting - Association for Computing Machinery
Key Words and Phrases: prettyprinting, formating, paragraphing, text editing, ... If the blanks in the block are inconsistent, then a new line will...
Read more >
Bug #1733222 “print-level in pretty-printer inconsistent with no ...
print-level in pretty-printer inconsistent with non-pretty. Bug #1733222 reported by Douglas Katzman on 2017-11-19. 6. This bug affects 1 person ...
Read more >
Inconsistency between operator priority and pretty-printing (#20)
Inconsistency between operator priority and pretty-printing. The Heptagon equation. o = 0 fby (2 * o). is pretty-printed as. o = 0 fby...
Read more >
Inconsistent print color output - looking for advice
Looks pretty close... not very scientific but ... a start for now. (I don't have space, money for high end monitor and calibration...
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