KibanaSavedObjectMeta.searchSorceJSON format

Hi, I am using kibana as an iframe in angular-8 application. I have kibana savedObject something like this.

I want to know how can we parse the KibanaSavedObjectMeta.searchSorceJSON with out '' ?

What we are getting :
"kibanaSavedObjectMeta": {
"searchSourceJSON": "{"query":{"language":"kuery","query":""},"filter":,"highlightAll":true,"version":true}"
}

I want like this without '':
"kibanaSavedObjectMeta": {
"searchSourceJSON": "{"query":{"language":"kuery","query":""},"filter":,"highlightAll":true,"version":true}"
}

Please let me know how can i remove the '' ?
Please help me.

Thanks in Advance.
Kavya Nagarapu

The way Kibana saves its saved objects is a little convoluted. Each individual saved object (so each visualization, each dashboard and so on) is a document in a special Elasticsearch index .kibana. These documents contain different properties based on the saved object type. In a lot of cases the saved objects contain deeply nested and dynamic object structures (e.g. the search source definition you stumbled over). In this case, the complex part is stringified as JSON again and put into the document JSON as a simple string to simplify the object tree. So now we have JSON nested within JSON - to get to the complex object, you have to pick the inner JSON string from the outer object and parse it again:

const searchSourceJSON = myObject.kibanaSavedObjectMeta.searchSourceJSON;
const parsedSearchSource = JSON.parse(searchSourceJSON);
// access inner properties with parsedSearchSource.filter and so on

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.