Replies: 1 comment
-
Using macros, not at the moment. See https://json.nlohmann.me/features/arbitrary_types/ for how to implement the (de-)serialization functions yourself. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The issue is in my client.
my client code below:
class TestSty1
{
public:
std::string id = "";
bool enabled = false;
bool auth = false;
public:
NLOHMANN_DEFINE_TYPE_INTRUSIVE(TestSty1, id, enabled, auth,groups);
};
parsing code:
json value = json::parse(in);
TestSty1 s = data.get();
json from server:
{"id":"66de14b44e9c700c06602952f52c81451f0dd4eb7bc3c112","enabled":true,"groups":null,"decision":"PERMIT","auth":null}
If the auth or groups is null , it can not parse it. s.id == "".
it only can parse json like this below:
{"id":"66de14b44e9c700c06602952f52c81451f0dd4eb7bc3c112","enabled":true,"groups":[],"decision":"PERMIT","auth":true}
Is there any idea can resolve it ?
Beta Was this translation helpful? Give feedback.
All reactions