Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to convert CSV Row objects to JSON #30

Closed
vincentlaucsb opened this issue May 8, 2019 · 0 comments
Closed

Add ability to convert CSV Row objects to JSON #30

vincentlaucsb opened this issue May 8, 2019 · 0 comments

Comments

@vincentlaucsb
Copy link
Owner

Requirements

  • Add a method to CSVRow that converts it to a valid JSON string.
    • Strings should contain minimal whitespace
    • Characters that have special meaning in JSON need to be escaped properly
    • Method should throw an error if non-Unicode characters are found
  • Add unit tests for above method

For example, if there's a row with column names "Artist" and "Album" with entries "Florida Georgia Line" and "Here's To The Good Times" respectively, then the output should be

{"Artist":"Florida Georgia Line","Album":"Here's To The Good Times"}

Suggestions

We may consider using another C++ library to handle JSON serializing instead of implementing it ourselves. That library can then be added as an optional dependency, e.g. users will need to have that library to use JSON serialization. For unit tests, that library can be included under the /tests/ directory.

Suggested library: https://github.com/nlohmann/json

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant