Deep Bot - Twitch Streamer Assistant

Deep Bot => Feature Requests => Topic started by: TheDefiant604 on April 26, 2017, 07:35:44 PM

Title: Process JSON data from a file
Post by: TheDefiant604 on April 26, 2017, 07:35:44 PM
Could a way to process JSON data from a file be added?  Something like @readjsonfile@[file.txt,payload.object.key].

This would reduce demand on API servers for commands that need to read multiple values.  I currently have a command that reads eight values from an API.  That means eight separate requests to the API each time the command is run.  Even more, if I add more information to the command.  It would be much more efficient if I could make a single API request and store the JSON payload in a file that I could then read as many times as needed.

Example:
Code: [Select]
@savefile@[jsonpayload.txt,@customjsonapi@[https://site.com/api]]Value 1 is @readjsonfile@[jsonpayload.txt,payload.object.key1]. Value 2 is @readjsonfile@[jsonpayload.txt,payload.object.key2].
* Probably have to use @customapi@ to retrieve the whole payload, to avoid an error from @customjsonapi@ not being given the "field" variable.
Title: Re: Process JSON data from a file
Post by: TheRealAlixe on May 02, 2017, 04:25:15 AM
If you have a website of your own you could make a api that spits out all the info from a single json in one go
Title: Re: Process JSON data from a file
Post by: TheDefiant604 on July 03, 2017, 12:46:29 PM
If you have a website of your own you could make a api that spits out all the info from a single json in one go

I ended up doing this.  I finally found a free web host, without advertisements, that allows PHP.  So now I'm making a single @customapi@ request to a script I wrote that is making a single request to the necessary JSON API, and outputting a formatted string that includes all the necessary data.

For anyone else trying to do this, https://freehosting.host/ offers free web hosting without any advertisements, with SSL/TLS, PHP, PERL, SQL, FTP and e-mail.  Setup requires a $0.01 verification charge via PayPal, which is refunded the next day.  For more information: https://freehosting.host/products/compare-web-hosting-plans/
Title: Re: Process JSON data from a file
Post by: rylan7 on November 02, 2017, 03:19:05 PM
This tool might help: json formatter (https://jsonformatter-online.com/)