mholt/json-to-go

About escape characters

kevsersrca opened this issue · 3 comments

I tried json-to-go with the chrome-lighthouse json file. But struct names are not cleared, so I can't use them. Therefore I can't unmarshall json.

Example:

 "lighthouse-core/audits/is-on-https.js | title": [
        "audits[is-on-https].title"
      ],

result:

LighthouseCoreAuditsIsOnHTTPSJsTitle            []string `json:"lighthouse-core/audits/is-on-https.js 
| title"`
mholt commented

What is unusable about that result, exactly? It looks fine to me. Or am I missing something?

`json:"lighthouse-core/audits/is-on-https.js 
| title"`

So it \n adds. therefore return error.

mholt commented

There is no line break when I paste your input into JSON to Go:

type AutoGenerated struct {
	LighthouseCoreAuditsIsOnHTTPSJsTitle []string `json:"lighthouse-core/audits/is-on-https.js | title"`
}

(That's a direct copy+paste)

Probably has something to do with your system.