News for hackers. Stuff that matters.
Re:Time to retire the CSV? by dheera on Wednesday August 18, 2021 @05:18PM (#28227299)
CSV is still easier to parse because the C++ dudes still refuse to implement some kind of nice operator-overloaded interface like

    #include <json>

    std::json myjson("{\"someArray\": [1,2,3,4,{\"a\": \"b\"}]}");
    std::cout << (std::string)myjson["someArray"][4]["a"];
and the result is we have 50 different rogue JSON libraries instead of an STL solution. Until the STL folks wake up, boost::split can deal with the CSV.
Re:Time to retire the CSV? by mivade on Wednesday August 18, 2021 @05:19PM (#28227321)
Re:Time to retire the CSV? by dheera on Wednesday August 18, 2021 @05:25PM (#28227386)
ooh this is nice. STL should adopt it
Re:Time to retire the CSV? by meepmorp on Wednesday August 18, 2021 @07:59PM (#28228752)
Thank you!
Re:Time to retire the CSV? by RodgerTheGreat on Wednesday August 18, 2021 @08:43PM (#28229052)
A string split function is a poor choice if there's any possibility the CSV file contains quoted fields. Robust handling of both CSV and JSON requires a parser. In my experience, CSV can actually be trickier than JSON to parse because there are so many edge cases, alternatives, and ambiguities.