-
Notifications
You must be signed in to change notification settings - Fork 297
add (with recursive: true) returns improperly-formatted JSON #82
Comments
This might be an issue with the daemon. It would appear that it may not be properly chunking the response coming back. If I had to guess the |
many of our commands return a stream of json objects, not a json array. This is so that consumers of the api can act on the output before receiving the entirety of the output. Most json decoders (all of them that i've used) are able to handle this pretty well. The one issue that we have though, is that we should be putting newlines between the objects to be true 'ndjson'. |
the newline part should be fixed here: ipfs/kubo#1885 |
This also may be causing issues: ipfs/kubo#1882 |
@tinybike IPFS HTTP API started returning ndjson on 0.3.8, while in 0.3.7 returned a JSON array. This module is expecting a JSON array and trying to perform a parse on it, but since it is not valid JSON, it returns it as a string. We are working to upgrade it, but prioritised tests first #81, once tests are ready (tested against 0.3.7) we will add a proper ndjson parser. The focus on tests first is exactly to avoid this kind of bugs with API changes in the future. Sorry for the trouble, confusion. |
solved with latest release and IPFS 0.3.9 :) |
The
add
method (withrecursive: true
) isn't returning properly-formatted JSON for me. Instead I get a string that almost looks like JSON, but isn't actually, so to parse it I have to do some string mangling. Example:This prints out:
(Note the lack of commas between the objects, and lack of enclosing array brackets.)
The text was updated successfully, but these errors were encountered: