Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I've heard this a lot but don't understand where this idea comes from. With JSON you can strip whitespace whereas with YAML you're stuck with all these pointless whitespace tokens you can't do anything about.

I would recommend the exact opposite, JSON is just as effective while using less tokens.

This example JSON:

{"glossary":{"title":"example glossary","GlossDiv":{"title":"S","GlossList":{"GlossEntry":{"ID":"SGML","SortAs":"SGML","GlossTerm":"Standard Generalized Markup Language","Acronym":"SGML","Abbrev":"ISO 8879:1986","GlossDef":{"para":"A meta-markup language, used to create markup languages such as DocBook.","GlossSeeAlso":["GML","XML"]},"GlossSee":"markup"}}}}}

Is 112 tokens, and the corresponding YAML (which I won't paste) is 206.

What am I missing?



Nothing. They just didn’t realize that JSON doesn’t need to be pretty-printed :)


In my experience, the non-human characters cause GPT a lot of problems. They break a lot of the magic of GPT.


I keep going back and fourth between the two.

I have absolutely no proof but sometimes feel like the responses I get are weaker if there is no white space in the structured data.


This is fair, typically I supply data as compact JSON but ask for responses as pretty printed JSON which is quite a large token penalty but tends to strongly reduce malformed JSON outputs.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: