-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
Feature: to_string(const json& j); #916
Comments
Agreed, would you like to open a PR? This one seems quite easy to implement :) |
What would be the expected result? |
That's what I would expect, do you agree @DELTA37? |
I guess that .dump() is already enough, unless the intent is to replace .dump()! |
The use-case I see would be something like the following: // in some generic code
template <typename T>
void doStuff(T const& value) {
using std::to_string;
auto const str = to_string(value);
// process the string
} Other than that, I agree that |
Yes, i guess to add "to_string()" method which will do the same as dump() That is a discussion https://stackoverflow.com/questions/33399594/making-a-user-defined-class-stdto-stringable // Sorry for my English |
#918 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@nlohmann is this still available? It doesn't seem terribly important but it was marked as good first issue so :) |
@Macr0Nerd Yes, it is! There were open issues in PR #918, so this issue was never fixed. |
Alright! So @nlohmann all I need to is read a function that takes the JSON key, and pulls a deserializes the data into a key, correct? I’m still relatively green to C++ but I’ll give this my best! |
No, a |
I think i see what you want (and based on the previous responses). It seems that you want to add an argument dependent lookup like this comment from the SO post from above. As it wasn't requested, I wouldn't overload the I also apologize if I ask too many questions, I'm just of the mentality that it should be done right the first time (for the most part) |
@nlohmann I believe I understand the purpose of this feature. It seems as if though the logic (and code) of dump would do the job here. I want to know if this is alright and what you want/expect |
Well for lack of understanding and the fear of messing up a very useful product, I will be removing myself from this problem @nlohmann |
Basically look at https://github.com/nlohmann/json/pull/918/files and follow the comments. |
@nlohmann I put |
Closed by merging #1585. |
It is very helpful to add method to_string(const json& j);
The text was updated successfully, but these errors were encountered: