What is the fastest way to consume an JSON? [closed] - javascript

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I call a JSON with 7000 objects (I use the JS filter direct in the GET's scope and keep the response in a variable) by GET's axios and as you can see from the image it's taking too long, affecting SEO :(
It's 3 seconds delay!
I've done something:
I packed JSON with gzip
I used minify in the JSON*
I put cookies for 1 year on htacess
I put the direct filter on the GET call
Things I want to do but I am unsure and I need your help:
Use Algolia
Split JSON into parts
Can anyone help me please i can't find the answer is i have been looking for this for months :(((

You can implement pagination on your backend to send JSON in smaller peaces or open an stream to read the JSON string and parse it as it's comes

Related

How can I create a web app to edit a large JSON manually? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 days ago.
Improve this question
I have a large JSON file, about 100 MB in a folder. I'd like to manually inspect some attributes, and then add more attributes to some of the objects and finally save changes and get output a modified json file.
Can someone suggest me how to do that?
I wanted to try with vue.js framework but I'm not very expert. If you know a video tutorial about this, please let me know.
Is using vanilla JavaScript the right choice or not?

Is there a way to get an Object from an Array Javascript [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
Coding in javascript, and I am trying to put objects into arrays, and the Array looks like
arr = [
{"id":1,"location":"Place1"},
{"id":2,"location":"Place2"}
]
I am trying to do arr[1].location, but arr[1] is undefined and console.log(arr[0]) and arr[1] in inspect element just returns as a "{". Im not sure if this is a chrome thing, but node does seem to accept the format.
Edit: I am collecting from a api that I made and this is the format it returns the code, I am just trying to access variable location. I am asking how would I get said variable
Problem answered in comments, didn't parse data.
Did you try parsing your data when received :
JSON.parse(apiResponse)
The problem was the way I handled the data. Instead of using a XMLHttpRequest for the array, I used jquery to request the data, and that seemed to work better for my API.

Reading a JSON file to edit [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I was given a JSON file and told to read it to get a better understanding of how JavaScript programming works and edit this file to do what I need it to do. It's supposed to be a file to run some cleaning processes on client computers, so I just need to edit it so that they file will run all the processes I want it to run without having to send multiple commands to the computer through my RMM.
When I open the file however in Sublime Text 3 it looks like this. How do I get it to read as JavaScript programming language so I can edit it?
{"os":3,"procedure_type":1,"name":"Clear_PrinterSpool_DNSCache_EventLogs","description":"","version":"2.0","payload":"cX8e1mZa4ffL5OfFuWnR+cqMYnnhpC5Myt22X+nx5dMeS1BYFK5yLlxTPWDPMiw3c0XnZD7Y5zrPIRD9EIxuYLEAa3MYYHZVHhfIUb5MeDifqw3+FHhA/IjFcyL9eSzJ/Nmt2TLu5bPSTQkzqBT9GAdiL0YsDxqn8mpttL0mDCa0g5gJ0vfI41lynD0L8pma6dQ5b3+I+JhSq9irNcHMRrhUkL8dfRUrzIasT/s0q0Ksy0jVu/lcMH+ab0CFlxRMB3aP5dZkBkjTPa4n54pX8yOHejnTbi0qXxVJSBLmFeV4Usw8f/dzbzdR+NN/qSaLP2JU4GXdHjgAIwk0Xb09oFbOhJIu4r7rPku0zLcaq5YXufXXWgzHmBo0AFg1xkGztsfA639dlxZXECxVx4ykMJWnFGl4nowGqsflHSddA4/Q72Nr0ZUm0nM2VAyBhQe8HZ2Z1FwRdBzM8i/YsC6LTGXXjgnn0xin/W2+y+7P+t4n0UFFFAaRT68GuvA/IuwuRjNEIfwhRo5s+qf5D9N1Rbxb/+dvzVVIuwrUIa8HZFHLJM1m4NURNCOTI3aW2o+Qigeah2AOVK4i/mIo94GJ4cnm4odFlli70R8XuKVFzNuKAHfn/TvMorlTdeWaYlLGB67EMtVvGEgSDPCk0mSJkWMzzHm+bxZo+LIAAspBjZuivP68kSm+2FKpMWqlmlKvlx9M+oy+P0koePHx3Ndi4p+Lsm9/mgHyvp3ZdfgmPuMdzOvrMlcibzdAi6e+TohtcQIJpk/yk5OIHgTysbSahwACiwaSLwqLh4SfcQRmmBAn8GoIA+PyD4g3zyErJmaJo6HcpJUcH0g7ytV/rotVvpr+2zW49fPRnCcm8q5pt12qROby42bLUMp/rm03EM+MUKB6I+YzWHENm8tg/O7UDanCyz7DIBbDl4hob8KtL7PA0QDjd9KQ61l/Ld7fNQ9vjNDD+uVaGyDim1ANhwdPMX/nJmvKmVc37XOgEd0AsmicZ8W2FobZpM3yfAdxD3to52N9fwC7T9exYE50RG7+McS+mtd8BRicXe5QfSH5P12GDM9+LaaUVdKzm63FZzhyX/0xpGN97q1VNKPAa6CfO5D/LD21mCrrPeOCeYJ2lHtTo7cW2iu7AXx0WRusz9PX162D+eqeo/ZFmflQv4MpMxnc00pT+QRxX3YZhX/50YU=","payloadChecksum":"d80877609ce0b19f6dcbe3c35d57cd03"}
You can just create a backend call, the URL being pointed to the location of this JSON file.
In the result of that backend call, you will get the contents of the JSON file.

How do you retrieve json object from a searched website using getJSON or other method? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
How do I use .getJSON() to get JSON-encoded data from a website that is searched?
I create a Google Custom Search API for my website, and my goal is to retrieve the JSON file from the result.
Let's say when I typed "apple" in my Google Custom Search bar from my website, the result would look like what this picture shows
How do you retrieve the JSON object from this result?
Such as the title, URL, and the description?
Thank you!
The result is not returned as JSON but HTML, you should inspect the HTML form (debugger) and how you can build your own functions that turn a html structure to a JSON structure!
Also there is lot of librairies that doing the conversion HTML to JSON. Here is one of them : https://github.com/Jxck/html2json ...

Types of output that will work for a callback [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I am currently working on a small nodejs project that is responsible for returning search terms from a twitter feed. I have the search working however because I am new to this I am having problems displaying this on my webpage. The search information I want to display is being held by a callback from my function and I want to output this information. Keep in mind this information is ascertained after the webpage is loaded and I think that is why response.write(information); is not working for me. However if I do console.log(information); I do get the information I want but it's just not where I want it. Can someone help me out with outputting please.
I ended up solving this by using JSON.stringify(information);
You are right, it's very likely that once you have returned your webpage the response will be closed.
2 options:
1) you load your webpage first on 1 static route (using static middleware) and this web page then does an ajax call to a second route which returns your information.
2) you don't return your webpage until you have retrieved your information. I'm assuming your information will need to be displayed on this webpage which means you'll have to turn your webpage in a template and merge it with your information. You can use a Jade template or underscore template for example.

Categories

Resources