- What is the issue you have?
When I create JSON string with this statement json j = {{}}; and print it, [null]is printed on Linux, while [{}] is printed on Mac. I think the Linux one is erroneous.
- Please describe the steps to reproduce the issue. Can you provide a small but working code example?
main.cpp:
#include "json.hpp"
#include <iostream>
using json = nlohmann::json;
using namespace std;
int main()
{
json j = {{}};
cout << j << endl;
return 0;
}
Compiled with g++ -std=c++11 main.cpp.
- What is the expected behavior?
The expected behavior is that both printouts should be [{}].
- And what is the actual behavior instead?
I get [null] when I run the same code on Linux.
Linux operating system: Ubuntu 18.04.4 LTS
Linux compiler: g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Mac operating system: macOS Catalina Version 10.15.3
Mac compiler: Apple clang version 11.0.0 (clang-1100.0.33.17)
- Did you use a released version of the library or the version from the
develop branch?
I am using release version 3.7.3.
No error while compilation.
When I create JSON string with this statement
json j = {{}};and print it,[null]is printed on Linux, while[{}]is printed on Mac. I think the Linux one is erroneous.main.cpp:Compiled with
g++ -std=c++11 main.cpp.The expected behavior is that both printouts should be
[{}].I get
[null]when I run the same code on Linux.Linux operating system: Ubuntu 18.04.4 LTS
Linux compiler: g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Mac operating system: macOS Catalina Version 10.15.3
Mac compiler: Apple clang version 11.0.0 (clang-1100.0.33.17)
developbranch?I am using release version 3.7.3.
No error while compilation.