-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Write unsigned long to a json file #879
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
Comments
Example: Value(Int value);
Value(UInt value);
#if defined(JSON_HAS_INT64)
Value(Int64 value);
Value(UInt64 value);
#endif // if defined(JSON_HAS_INT64)
Value(double value);
...
Value(bool value);
Value can be constructed from a handful of arithmetic types, not all of them. Also see discussion on PR #66. |
@BillyDonahue Thank you for your reply. I am using jsoncpp on a raspberry pi. If i wanted to write to a json file from an unsigned long variable, how would i proceed? It keeps telling me that it cannot convert from unsigned long to Json::value. If I declare a Json value and then assign my variable to that value, it still says the same thing. Any help would be greatly appreciated. |
You have to cast to Jason::UInt.
RPi can be 32- or 64-bit depending on which OS you’re using, but it’s
usually 32-bit Rapbian OS. So your unsigned long is 32-bit. So it is
narrower than Jason::UInt64, but outranks Jason::UInt. There’s no clear
choice of conversion, so you have to do it yourself. I think we should
revisit this API issue though and try to accept any integral whose range is
fully representable.
On Mon, Jan 21, 2019 at 11:03 PM Zuputmer ***@***.***> wrote:
@BillyDonahue <https://github.com/BillyDonahue> Thank you for your reply.
I am using jsoncpp on a raspberry pi. If i wanted to write to a json file
from an unsigned long variable, how would i proceed? It keeps telling me
that it cannot convert from unsigned long to Json::value. If I declare a
Json value and then assign my variable to that value, it still says the
same thing. Any help would be greatly appreciated.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#879 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHFzPFAA_q2wQZQz0FY3BDBG24Zv4T69ks5vFo2WgaJpZM4aKjjx>
.
--
ǝnɥɐuop ʎllıq
|
Hi, i am new to jsoncpp, so please forgive my question if it sounds ridiculous. I have an unsigned long value that i need to write to a json file. But whenever i try, i encounter the following error-
error: conversion from ‘long unsigned int’ to ‘Json::Value’ is ambiguous event ["Node Values"]["Moisture"]= (num);
Any help would be greatly appreciated.
The text was updated successfully, but these errors were encountered: