Getting Data In

How to work with JSON file from JS?

rendie
Path Finder

Hi,
I have to write some information to JSON file because of this method comfortable for me, but when I am trying read JSON file from JS file I have an error with 404 code.
How to fix it? How work with JSON file from JS file in /appserver/static?
Thanks.

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@rendie

Can you please share your sample javascript code for JSON file read/write opearation??

0 Karma

rendie
Path Finder

@kamlesh_vaghela

require([
"splunkjs/mvc", "jquery",
'splunk.util', 'splunkjs/mvc/tableview',
'splunkjs/mvc/searchmanager',
'splunkjs/mvc/simplexml/ready!' ], function(mvc, $, splunkUtil,
TableView ) { var request = new
XMLHttpRequest(); request.open('GET',
'saved.json', true); request.send();
console.log(request.statusText); });

JSON and JS in one folder, is /appserver/static

0 Karma
Get Updates on the Splunk Community!

Index This | When is October more than just the tenth month?

October 2025 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What’s New & Next in Splunk SOAR

 Security teams today are dealing with more alerts, more tools, and more pressure than ever.  Join us for an ...