Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON data support #40

Closed
zkessin opened this issue Aug 12, 2014 · 2 comments
Closed

JSON data support #40

zkessin opened this issue Aug 12, 2014 · 2 comments

Comments

@zkessin
Copy link
Contributor

zkessin commented Aug 12, 2014

It would be nice if we had a way to support JSON data, If you decode a json with JSX you get a data structure like this [{<<"test">>, 12345}], the problem is that if you try to pass that to prolog it thinks that the first element of the tuple is callable. When I ran this test https://gist.github.com/zkessin/52c96f8d5e6285497e8f I get this error:

json_test: json_test (module 'json_test')...*failed*
in function json_test:'-json_test/0-fun-0-'/1 (test/json_test.erl, line 10)
**error:{assertMatch_failed,[{module,json_test},
                     {line,10},
                     {expression,"erlog : prove ( ERLOG_STATE , { length , Data , { 'Len' } } )"},
                     {pattern,"{ { succeed , _ } , _ }"},
                     {value,{{error,{type_error,callable,{<<"test">>,12345}}},
                             {est,[],[],[],0,{db,erlog_db_dict,...}}}}]}
@rvirding
Copy link
Owner

It would now be better to use maps to represent JSON data. This would make it easier to use and make it easier to handle the case where you have lists of objects as data. There is jsxn which is an extension to jsx which does this.

@zkessin
Copy link
Contributor Author

zkessin commented Aug 17, 2014

I think you are right, closing in favor of #38

@zkessin zkessin closed this as completed Aug 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants