Skip to content

Commit db92961

Browse files
committed
debug node: better handling of JSONata expressions
1 parent a5bb102 commit db92961

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/ered_nodered_comm.erl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,12 @@ send_to_debug_sidebar(
160160
%% of "object" as opposed to "Object" (capital-o) causes less
161161
%% breakage. Definitely something to investigate.
162162
%% See info for test id: c4690c0a085d6ef5 for more details.
163+
Result = jsonata_eval_or_error_msg(Jsonata, Msg),
164+
163165
Data = ?ObtainFrom(NodeDef)#{
164166
<<"topic">> => ?TopicFrom(Msg),
165-
<<"msg">> => jstr(jsonata_eval_or_error_msg(Jsonata, Msg)),
166-
<<"format">> => <<"string">>
167+
<<"msg">> => Result,
168+
<<"format">> => type_to_node_red_debug_type(Result)
167169
},
168170

169171
debug(ws_from(Msg), Data, normal);

src/ered_nodes.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ jstr(Str) when is_binary(Str) ->
137137
jstr(Str) when is_atom(Str) ->
138138
atom_to_binary(Str);
139139
jstr(Str) when is_integer(Str) ->
140-
integer_to_binary(Str);
140+
integer_to_binary(Str);
141141
jstr(Str) when is_float(Str) ->
142-
float_to_binary(Str);
142+
float_to_binary(Str);
143143
jstr(Str) ->
144144
list_to_binary(lists:flatten(Str)).
145145

0 commit comments

Comments
 (0)