4 ms·
I think we need to start distinguishing between data formats and configuration formats. JSON is a data format. I loathe working with NodeJS because of the neces
by vinceguidry 8y ago
I think we need to start distinguishing between data formats and configuration formats. JSON is a data format. I loathe working with NodeJS because of the necessity of hand-editing JSON, and that just makes me want to bash my head against the wall.
In my side projects, generally I'll hand-write a parser with regular expressions because I haven't yet found one I actually like both looking at and editing. I can fix every single other problem except that one. With SAN, the issue is the bracket delimiters. I hate futzing with them, just let me use tabs. I want this:
Monthly Recurring
Patreon: 8 | 9/17/2018 | 2mo - Acc: Capital One - Tags: arts
Workflowy: 4.99 | 9/17/2018 | 6mo - Acc: Amex - Tags: tools
RubyTapas: 15 | 9/17/2018 | 6mo - Acc: Amex - Tags: education
Verizon: 70.17 | 9/17/2018 | 6mo - Acc: Amex - Tags: utilities,tools
This is easy to look at, easy to edit with a text editor, and, once the parser's written, dead simple with Ruby POROs, easy to parse into queryable data structures.
I have yet to find any format that's intended to be human-editable that doesn't actually feel 'nice to the touch'. So I just make my own.
When hand-editing the format above, I generally don't type in a whole line at a time. I'll just add in the basics, and fill it out later, perhaps with machine processing. Tags in particular are easy to copy-paste in by hand and are generally the last part of the line.
- z0mbie42 8y agoHi, good reply. The reason for brackets are auto formatting by the san CLI (think go/rust fmt)
- vinceguidry 8y agoWith a data format, you need auto-format, you have no idea what shape it's going to be in and it has to handle arbitrary everything. With a configuration format, you want a highly consistent structure, the machine should be able to output it just with print statements. If my configuration needs auto-formatting, something's gone very very wrong in the design of my application.
- Entangled 8y agoTry Dixy :) https://github.com/kuyawa/dixy https://github.com/kuyawa/dixy
- vinceguidry 8y agoSomeone else's hand-rolled parser isn't going to be my hand-rolled parser.
- kjeetgill 8y agoWhile I like python style indentation I absolutely cannot accept unquoted strings. Bonus points for a good multiline string format. I hate, hate, hate the ambiguity and the flavor of the week tokenization/operator precedence/does it trim whitespace questions. This is JSON's biggest strength: it's trivially unambiguous.