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

Allow The Colon Key-Value Delimiter To Have A Space Before It [@ READ ONLY] #1735

Closed
ClaudiuHKS opened this issue Sep 2, 2019 · 2 comments
Closed
Labels
kind: enhancement/improvement state: needs more info the author of the issue needs to provide more details

Comments

@ClaudiuHKS
Copy link

Example of current use ->

Only { "Name": "Michael", "Age": 24 }

Example of use after this feature request ->

Either { "Name": "Michael", "Age": 24 } or { "Name" : "Michael", "Age" : 24 }

Note! This feature request should only affect the functions that read the trees. Those functions that write should remain the same.

@ClaudiuHKS ClaudiuHKS changed the title Allow The Colon Key-Value Delimiter To Have A Space Before It Allow The Colon Key-Value Delimiter To Have A Space Before It [@ READ ONLY] Sep 2, 2019
@nlohmann
Copy link
Owner

nlohmann commented Sep 2, 2019

This is already supported by the library:

#include "json.hpp"
#include <iostream>

using json = nlohmann::json;

int main()
{
    std::string s1 = R"( { "Name": "Michael", "Age": 24 } )";
    auto j1 = json::parse(s1);

    std::string s2 = R"( { "Name" : "Michael", "Age" : 24 } )";
    auto j2 = json::parse(s2);
    
    std::cout << j1 << '\n' << j2 << std::endl;
}

Output:

{"Age":24,"Name":"Michael"}
{"Age":24,"Name":"Michael"}

Did I miss anything?

@nlohmann nlohmann added the state: needs more info the author of the issue needs to provide more details label Sep 2, 2019
@ClaudiuHKS
Copy link
Author

Thanks for your proper answers, looks like my fault, closing now!
Have a good day though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: enhancement/improvement state: needs more info the author of the issue needs to provide more details
Projects
None yet
Development

No branches or pull requests

2 participants