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.

Wrong type in json

See original GitHub issue

Here https://github.com/ebroecker/canmatrix/issues/102 not only the internal representation but also the json export itself were changing. That lead to

"factor": str(signal.factor),
"offset": str(signal.offset),
"min": str(signal.min),
"max": str(signal.max),

In my opinion it is okay to handle it internally as a different type but json allows floating point numbers, so why not use it? The change basically requires everyone using such an exported json to convert the string back to float.

May I ask why this was changed? Any chance to revert the export back to using float instead of string?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
chrisorocommented, Aug 1, 2019

Ok, I understand now. How about adding a --useNativeTypes argument that basically does what the name suggests: use native data types of the output format?

By default it is all strings (which we should mention in the docs) and if that arg is given you use whatever the output format allows.

0reactions
chrisorocommented, Aug 1, 2019

OK, I’ll implement it as soon as I have time. (likely in the next few days). I will only add that option to work with json though, we can expand it as needed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Json Exception wrong type - java - Stack Overflow
Problem is at line "info": {} in your json string. Your class have private String info; String type and in your JSON string...
Read more >
SyntaxError: JSON.parse: bad parsing - JavaScript | MDN
JSON.parse() parses a string as JSON. This string has to be valid JSON and will throw this error if incorrect syntax was encountered....
Read more >
JSON error handling
In cases where a JavaScript Object Notation (JSON) transaction fails, the API Gateway can use a JSON error to convey error information to...
Read more >
Unmarshaling json in Go (error checking missing)
Hi, as I understand Go presumes strict error handling. So why there is no way to way to check if json was unmarshaled...
Read more >
How to allow some kinds of invalid JSON with System.Text.Json
In this article, you will learn how to allow comments, trailing commas, and quoted numbers in JSON, and how to write numbers 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