glaze icon indicating copy to clipboard operation
glaze copied to clipboard

array with mixed data types can't be deserialized with read_jmespath

Open scalpel4k opened this issue 8 months ago • 1 comments

I have this message:

[1,"a","b",{"c":1}]

I was trying to read the first 2 entries using this call:

std::tuple<int,std::string> target;
auto err = read_jmespath<"[0:1]">(target, buffer);

However, I get a syntax_error.

When I changed the first entry to become a string and deserialize that into a std::vector<std::string> the conversion was working. Also the deserialization of a single value works, just not the tuple.

In addition, I need to use this from inside a from<> specialization. Calling read_jmespath isn't ideal. Would it be possible to make the jmespath feature available directly from that context?

I need this because the JSON structure looks different, depending on the first array element.

thx Michi

scalpel4k avatar Jul 06 '25 16:07 scalpel4k

Thanks for reporting. I'm currently occupied for a couple weeks, so I won't get to this immediately. But, I'll try to address this as soon as I'm able.

stephenberry avatar Jul 07 '25 11:07 stephenberry

This should be implemented in #2081. Thanks for this request!

stephenberry avatar Nov 22 '25 22:11 stephenberry