3 ms·
Why in the world would I have to use JavaScript or any object oriented programming language just because the application is poorly thought out and emits JSON? I
by Annatar 9y ago
Why in the world would I have to use JavaScript or any object oriented programming language just because the application is poorly thought out and emits JSON? I certainly have better things to do.
It doesn't matter how sensible a format is, those tools are simply not appropriate to write a parser in.
AWK is a language designed for data parsing and processing. That is what it is designed to do.
How did you solve the parsing of arbitrarily nested structures?
- jhomedall 9y ago> How did you solve the parsing of arbitrarily nested structures? Write a recursive descent parser, or use a parser generator. Or, more realistically, use one of the many libraries available for parsing it (pretty much every language has one at this point).
- mikerybka 9y agoHope one of these helps with your problem: https://github.com/step-/JSON.awk https://github.com/step-/JSON.awk https://github.com/dominictarr/JSON.sh https://github.com/dominictarr/JSON.sh
- rarepostinlurkr 9y agoJson is clearly data. If awk cannot parse it, perhaps it’s a shortcoming of awk? =)
- Annatar 9y agoIt’s not an AWK limitation; recursive descent parsers are non-trivial to implement and tricky to get right.