Open RazielXYZ opened 1 month ago
Tested on msvc, glaze 3.1.9, 3.2.1 and 3.2.5
Given code such as
#include <iostream> #include "glaze-3.2.5/include/glaze/glaze.hpp" struct FirstStruct { int64_t MyVar {}; }; struct SecondStruct { int64_t OtherVar{}; }; int main() { std::pair<FirstStruct, SecondStruct> testPair{ {1}, {2} }; std::string buffer; auto ec = glz::write_json(testPair, buffer); if (!ec) { std::cout << buffer << std::endl; } else { std::cout << "Error: " << glz::format_error(ec) << std::endl; } std::pair<FirstStruct, SecondStruct> testPair2; auto testPairDeserRes = glz::read_json(testPair2, buffer); if (!testPairDeserRes) { std::cout << testPair2.first.MyVar << ":" << testPair2.second.OtherVar << std::endl; } else { std::cout << "Error: " << glz::format_error(testPairDeserRes, buffer) << std::endl; } return 0; }
The output is
{"{\"MyVar\":1}":{"OtherVar":2}} Error: 1:17: expected_quote {"{\"MyVar\":1}":{"OtherVar":2}} ^
If using a pair of fundamental types, the round trip succeeds. It looks like this is treated as a map, and the "key" is quoted when serializing, but the deserialization also expects the value to be quoted?
Yes, this is an active issue here #1000, but thanks for bringing more attention to it.
I see, I wasn't sure if it was related since that mentioned arrays specifically. Thanks!
Tested on msvc, glaze 3.1.9, 3.2.1 and 3.2.5
Given code such as
The output is
If using a pair of fundamental types, the round trip succeeds. It looks like this is treated as a map, and the "key" is quoted when serializing, but the deserialization also expects the value to be quoted?