[json.exception.type_error.304] cannot use at() with array - works in windows, fails in linux (gcc) #4824
-
|
I cannot get past error 304 cannot use at() I've tried streamstrings, strings, removing the defines and coding directly #define MQTT_LIVEVIEW_STATION_TAG "stationId" struct LIVE_VIEW_REQUESTA void to_json(json& j, const LIVE_VIEW_REQUESTA& A) void from_json(const json& j, LIVE_VIEW_REQUESTA& A) int main(void) auto text = R"( { "timeStamp" : "2025-06-17T20:01:23.4156036+00:00", "stationId" : "FL_LAK_1", "action" : "start", "duration" : 10 } )"; json Doc{ json::parse(text) }; try { |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
|
See https://json.nlohmann.me/home/faq/#brace-initialization-yields-arrays |
Beta Was this translation helpful? Give feedback.
-
|
Much appreciated, particularly considering the late hour. that change seems to have corrected the problem
Calvin Winey - Mechanical Engineer / Programmer - Finish Line PDS
A Better Way for Small Companies to Develop Products
e
|
***@***.***
p
|
603 769-7547 (cell)
w
|
www.FinishLinePDS.com
94 River Rd | Hudson, NH | 03051
Click for Product Development White Papers<http://www.finishlinepds.com/documents.php>
…________________________________
From: Niels Lohmann ***@***.***>
Sent: Wednesday, June 18, 2025 2:28 AM
To: nlohmann/json ***@***.***>
Cc: Calvin Winey ***@***.***>; Author ***@***.***>
Subject: Re: [nlohmann/json] [json.exception.type_error.304] cannot use at() with array - works in windows, fails in linux (gcc) (Discussion #4824)
Replace
json Doc{ json::parse(text) };
with
json Doc = json::parse(text) ;
—
Reply to this email directly, view it on GitHub<#4824 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AYS7MKZFQ6GO5OSISB5F6OT3EEBIBAVCNFSM6AAAAAB7RQ5M7OVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTGNJQGQZTQMQ>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
Replace
json Doc{ json::parse(text) };
with
json Doc = json::parse(text) ;