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

Error when using a large json file #10

Open
MartinAskestad opened this issue Apr 14, 2024 · 5 comments
Open

Error when using a large json file #10

MartinAskestad opened this issue Apr 14, 2024 · 5 comments

Comments

@MartinAskestad
Copy link

I run for example curl -s https://openlibrary.org/search.json?q=Jules+Verne and I get a json document that is 27567 lines long. When I then run for example jq . openlibrary.json in command line everything seems to work fine and it prints the document to the screen.

But when I run this through vim-jqplay and the same query, I get the error // jq: parse error: Expected another array element at line 1935, column 13 but if I use curl -s https://openlibrary.org/search.json=ture+sventon as a data source vim-jqplay works as expected.

Is there a size limit to vim-jqplay?

@bfrg
Copy link
Owner

bfrg commented Apr 14, 2024

I run for example curl -s https://openlibrary.org/search.json?q=Jules+Verne and I get a json document that is 27567 lines long.

When I run this command, I get a json document that is 18656 lines long. I don't get any errors.

Is there a size limit to vim-jqplay?

No.

I have tested the plugin with a json document containing 56k lines and I had no issues.

Which OS and which vim version?

@MartinAskestad
Copy link
Author

I'm using Windows 11 and Vim 9.1.

@bfrg
Copy link
Owner

bfrg commented Apr 14, 2024

jq: parse error: Expected another array element at line 1935, column 13

This looks like a jq error. This is not a Vim or vim-jqplay related error.

When you run the curl command, do you run it in git-bash? And which Vim do you use on Windows, Gvim or the one shipped with git-for-windows?

In Vim, what is the output of :set shell??

@MartinAskestad
Copy link
Author

I run the command in plain old Windows command line, ie cmd.exe. The vim version I'm using is downloaded from https://github.com/vim/vim-win32-installer and the shell in vim is C:\WINDOWS\system32\cmd.exe.

I also think you are right, that the error message is from jq. And it seems like that it complains because the whole buffer isn't sent to jq. So perhaps the combination Windows and vim has a size limit? If I save my buffer as a file, does vim-jqplay use the path as parameter to jq or does it pipe the contents to it?

@bfrg
Copy link
Owner

bfrg commented Apr 16, 2024

If I save my buffer as a file, does vim-jqplay use the path as parameter to jq or does it pipe the contents to it?

The buffer is piped to jq. The jq job is started using Vim's job_start() function with the option 'in_buf'. This is explained in Vim's docs under :h in_buf.

It's either a Windows limitation or a Vim bug. I will look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants