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.

Error while parsing valid json

See original GitHub issue

First of all, thank you for this tool it is very helpful.

I was trying to encode this value:

[{"holder1": {"type1": [["value1", "value2"], ["value1", "value2"]]}}]

And it resulted in this error:

5:15: expected ';', found '[' (and 1 more errors)

The smallest structure that still shows the error is the following.

[{"holder1": {"type1": [["value"]]}}]

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
mike-hosseinicommented, Nov 21, 2019

Ah, you’re right. @mahdi-hosseini any idea what might be causing this?

Hi Matt, I will look into it this weekend!

1reaction
mike-hosseinicommented, Nov 25, 2019

The issue does not seem to be caused by gofmt but rather the output of jsonToGo() is invalid Go struct. There is an extraneous Type1 in the output when the function is called with flatten = true, see here: https://play.golang.org/p/tpFHAOmFQk8

So this is probably a bug. I may be able to look into it further when I have the time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

JSON.parse error on a seemingly valid JSON [duplicate]
The error is a result of data being an object, not JSON. You don't need to parse anything; it is already a JavaScript...
Read more >
How to handle invalid JSON parse error properly.
The most common way to handle JSON parse error is using try-catch block. If the JSON string is valid, it will return a...
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 >
What Is JSON and How to Handle an “Unexpected Token” Error
Learn what JSON is and how you can deal with errors occurring when parsing JSON data, such as "Unexpected Token < in JSON...
Read more >
Solved: Error while parsing JSON: 'Unexpected character en...
Hi there,. I have a flow created that uses SQL connector to connect to a database view and pulls records from there and...
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