i tried using this approach as soon as i replace the url with my dashboard which is publised on tableau server it does not generate the json. there there anything else i need to change in the code?
It's really difficult to say without some explanation of your issue and
Basically i have a tableau dashboard. i need to have a button on it which when i click will create a json from the dashboard which looks in below format.
"name": "Truven OMOP",
Now i have to pass this JSON as a POST Request to another external application using REST API i have not developed the logic or code. i need help on how to approach this requirement.
Take a look at the Javscript API reference - API Reference
Take a look at the filtering section, you'll see you can make a call to the method getFiltersAsync to fetch a collection of the filters used on the sheet.
You can take the results of that call and parse it into the structure you need to send to the other system.