-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
3 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
string _arg_expr_json_decode_2_271 = string_str(msg); | ||
cJSON* _t2 = json__json_parse(/*af arg2*/_arg_expr_json_decode_2_271); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// vtest vflags: -autofree | ||
module main | ||
|
||
import json | ||
|
||
fn main() { | ||
input := '{"methode":"test"}' | ||
decode_message(input) or {} | ||
assert true | ||
} | ||
|
||
type BaseMessage = struct { | ||
methode string @[json: methode] | ||
} | ||
|
||
pub fn decode_message(msg string) !string { | ||
decoded_json := json.decode(BaseMessage, msg.str())! | ||
return decoded_json.str() | ||
} |