[Libwebsockets] lejp float parsing issues

Andy Green andy at warmcat.com
Thu Jan 4 03:34:18 CET 2018



On 02/01/18 01:58, Michael Heinen wrote:
> I'm probably missing something simple, but I can't seem to get the json 
> parser to correctly parse json that has a float in it. I am using 
> the libwebsockets-test-lejp and I have a simple my.json file like:
> 
> [mheinen at morken_rhel7_1 bin]$ cat my.json
> {
>          "string":"test",
>          "integer":123,
>          "float":45.6
> }
> 
> Piping to libwebsockets-test-lejp gives the following output:
> 
> [mheinen at test_rhel7_1 bin]$ cat my.json | ./libwebsockets-test-lejp
> [2018/01/01 11:45:00:5382] NOTICE: libwebsockets-test-lejp  (C)2017 
> andy at warmcat.com <mailto:andy at warmcat.com>
> [2018/01/01 11:45:00:5382] NOTICE:   usage: cat my.json | 
> libwebsockets-test-lejp
> 
> [2018/01/01 11:45:00:5382] NOTICE: path: 'string' (LEJPCB_PAIR_NAME)
> [2018/01/01 11:45:00:5382] NOTICE:    value 'test'  (LEJPCB_VAL_STR_END)
> [2018/01/01 11:45:00:5382] NOTICE: path: 'integer' (LEJPCB_PAIR_NAME)
> [2018/01/01 11:45:00:5383] NOTICE:    value '123'  (LEJPCB_VAL_NUM_INT)
> [2018/01/01 11:45:00:5383] NOTICE: path: 'float' (LEJPCB_PAIR_NAME)
> [2018/01/01 11:45:00:5383] NOTICE: okay
> 
> It seems LEJPCB_VAL_NUM_FLOAT never gets called. I am on latest master.

Thanks for letting me know... it's fixed in current master and v2.4-stable

[2018/01/04 10:33:24:4813] NOTICE: libwebsockets-test-lejp  (C) 2017 - 
2018 andy at warmcat.com
[2018/01/04 10:33:24:4813] NOTICE:   usage: cat my.json | 
libwebsockets-test-lejp

[2018/01/04 10:33:24:4813] NOTICE: path: 'string' (LEJPCB_PAIR_NAME)
[2018/01/04 10:33:24:4813] NOTICE:    value 'test'  (LEJPCB_VAL_STR_END)
[2018/01/04 10:33:24:4813] NOTICE: path: 'integer' (LEJPCB_PAIR_NAME)
[2018/01/04 10:33:24:4813] NOTICE:    value '123'  (LEJPCB_VAL_NUM_INT)
[2018/01/04 10:33:24:4813] NOTICE: path: 'float' (LEJPCB_PAIR_NAME)
[2018/01/04 10:33:24:4813] NOTICE:    value '45.6'  (LEJPCB_VAL_NUM_FLOAT)
[2018/01/04 10:33:24:4813] NOTICE: Parsing Completed (LEJPCB_COMPLETE)
[2018/01/04 10:33:24:4813] NOTICE: okay

-Andy

> -Mike
> 
> 
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> https://libwebsockets.org/mailman/listinfo/libwebsockets
> 



More information about the Libwebsockets mailing list