Skip to content

Commit d52b584

Browse files
mike-scottioannisg
authored andcommitted
net: lwm2m: json: use plain text formatter for float32/64
Current JSON formatting for float32/64 is broken in a similar way as plain text. Let's use the newly fixed logic for plain text to generate the float32/64 values in the JSON string. Fixes: #16154 Signed-off-by: Michael Scott <[email protected]>
1 parent 404a4b8 commit d52b584

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

subsys/net/lib/lwm2m/lwm2m_rw_json.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ static size_t put_float32fix(struct lwm2m_output_context *out,
497497
size_t len;
498498

499499
len = put_json_prefix(out, path, "\"v\"");
500-
len += plain_text_put_format(out, "%d.%d", value->val1, value->val2);
500+
len += plain_text_put_float32fix(out, path, value);
501501
len += put_json_postfix(out);
502502
return len;
503503
}
@@ -509,8 +509,7 @@ static size_t put_float64fix(struct lwm2m_output_context *out,
509509
size_t len;
510510

511511
len = put_json_prefix(out, path, "\"v\"");
512-
len += plain_text_put_format(out, "%lld.%lld",
513-
value->val1, value->val2);
512+
len += plain_text_put_float64fix(out, path, value);
514513
len += put_json_postfix(out);
515514
return len;
516515
}

0 commit comments

Comments
 (0)