You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are no examples in the documentation of how to get an array in the desired format.
auto allows = jsr["allows"].get!Json[];
../../.dub/packages/vibe-d-0.9.6/vibe-d/data/vibe/data/json.d(1124,8): Error: static assert: "Unsupported JSON type 'Json'. Only bool, long, std.bigint.BigInt, double, string, Json[] and Json[string] are allowed."
../../.dub/packages/vibe-d-0.9.6/vibe-d/data/vibe/data/json.d(1200,36): instantiated from here: `typeId!(Json)`
../../.dub/packages/vibe-d-0.9.6/vibe-d/data/vibe/data/json.d(653,4): instantiated from here: `checkType!(Json)`
source/app.d(294,32): instantiated from here: `get!(Json)`
/usr/bin/dmd failed with exit code 1.
Are there any clearer examples about converting a large number of variables to Json? Without using prepared structures.
The text was updated successfully, but these errors were encountered:
This should be jsr["allows"].get!(Json[]) - and .get!(Json[string]) for reading JSON objects. It's missing the parenthesis, so that the [] applies to the return value of get() instead of being part of the requested type.
In general, you can serialize any D type to JSON using vibe.data.json.serializeToJson (or serializeToPrettyJson). Some types may need to be adjusted using custom toJson and fromJson methods to get a usable result, but most types work as-is. Similarly, if the JSON format is fixed, deserializeJson would be the quick way to parse JSON back into
How to properly receive JSON and send it, given that I do it this way?
How to read the array that is inside? It is not possible to lead to the desired type, writes errors.
There are no examples in the documentation of how to get an array in the desired format.
Are there any clearer examples about converting a large number of variables to Json? Without using prepared structures.
The text was updated successfully, but these errors were encountered: