Closed JhonnyJason closed 7 years ago
That's not valid JSON and I'm not sure how you are parsing this a JSON.parse()
won't accept your input:
SyntaxError: Unexpected token
in JSON at position 67
at JSON.parse (<anonymous>)
Are you using a custom parser? You only need to replace \n
by \\n
to make it parseable by Hjson.
Yhea I suppose it is not valid json. But I hoped that it is valid in hjson^^.
I'm using the Hjson.parse()
from the hjson.min.js.
Probably it is an older version as I have it this way now since close to a year now.
So the issue here is either that an update in the meantime has made the parser less human friendly^^. Or that the CLI version behaves differently from the browser version.
But yhea I guess I could do a script to get rid of the /n
's within the ""
s.
The problem is that you were relying on a bug that has been fixed in the meantime. Hjson supports multiline strings - I'm not sure though if that is what you want.
The easiest way is to use the old version to pipe it through - so you'll get it reformatted and it should then be working with the new version.
I hope this helped solve your problem.
yes Problem solved - thank you! :-)
Hello, Having a giant hjson file containing language strings like:
"en": "hello I am a potentially very long String"
I use it as a Module inside a Javascript App - there it works perfectly in in the current way. Using the cli it give's me the error:
Error: Bad string containing newline at line 153,106
SO basicly there are tons of these cases where I have like:
It would be awesome if this would't be a such a big deal :-)