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!

AI for AppInspect

We’re excited to announce two new updates to AppInspect designed to save you time and make the app approval ...

App Platform's 2025 Year in Review: A Year of Innovation, Growth, and Community

As we step into 2026, it’s the perfect moment to reflect on what an extraordinary year 2025 was for the Splunk ...

Operationalizing Entity Risk Score with Enterprise Security 8.3+

Overview Enterprise Security 8.3 introduces a powerful new feature called “Entity Risk Scoring” (ERS) for ...