-
Notifications
You must be signed in to change notification settings - Fork 53
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
GET on datasets created with fillvalue=np.NaN
give invalid JSON
#87
Comments
I've added a query option "ignore_nan" for GET values that will return null rather than NaN in the json response. Try out the nanvalue branch. Commit is here: 66a0dc0. Haven't added support for sql query operations or attribute data yet, but let me know if this resolves the immediate issue. BTW - Is there a mean to use binary responses from javascript? (guess you would need the javascript equivalent of numpy). Binary vs JSON would be more efficient esp. for larger responses. |
Yup, it fixes the issue for
This is something that we are actively exploring right now as it would indeed be more efficient and solve such issues. For the record, in h5web, we are using ndarray as the "JS numpy" which make projects like js-numpy-parser especially interesting to us. |
I've updated the branch to return the string "nan" in the fillValue for GET dataset. As with values, you'll need to add "ignore_nan" in the query option. See the commit here: 641eb6b. I'll look at attribute support next. |
And added attribute support here: e844162. I think this should be it for supporting possible NaN data responses. |
Merged to master. Will close issue - please reopen if you run into any problems. |
Sorry for not following this up earlier. It works fine 👍 ! The only missing piece would be that the JSON is still invalid when To be completely upfront, we changed our approach on h5web: we search for |
Say a dataset was created by h5py in the following fashion:
The dataset info created by GET_Dataset produces then a JSON with a field:
"creationProperties": {"fillValue": NaN}
.Unquoted
NaN
is not supported by the JSON spec so this cannot be parsed:The presence of this unsupported value is explained the JSON serialization which is made by
aiohttp.web.json_response
which in turn use json.dumps. The default behaviour ofjson.dumps
is to allow unquotedNaN
.A possible way to solve this would be to parametrize
aiohttp.web.json_response
to quoteNaN
or to sendnull
instead:Edit: This issue also pops when getting data that contains NaN
The text was updated successfully, but these errors were encountered: