<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Json parsing in DQL in DQL</title>
    <link>https://community.dynatrace.com/t5/DQL/Parse-JSON-in-Dynatrace-DQL-Queries/m-p/242156#M806</link>
    <description>&lt;P&gt;KVP is something to use, but due to what formatting valid JSON allows it is hard to express the pattern in the way it will always work independently e.g. how many blanks or new lines are between elements. I tried to be as generic as possible with it (but still assumed that "name" comes before "value"):&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;data record(data="""{"details":[{"timestamp": "2020-04-05T18:05:21+05:30","event_1": "","type": "business","Metrics": [ { "name": "PLATFORM", "value": "windows" }, { "name": "HOST", "value": "1111111" }, { "name": "VERSION", "value": "100" } ] } ]}"""),
     record(data="""{ "details": [ { "timestamp": "2020-04-05T18:05:21+05:31", "talktome": "", "type": "issues", "Metrics": [ { "name": "PLATFORM", "value": "ios" }, { "name": "HOST", "value": "1111111" }, { "name": "VERSION", "value": "100" } , { "name": "SDK", "value": "1.23" }] } ] }""")
| parse data, "DATA '\"Metrics\":' SPACE* '[' KVP{ SPACE* '{' SPACE* DQS ':' SPACE* DQS:key SPACE* ',' SPACE* DQS ':' SPACE* DQS:value SPACE* '}' SPACE* (','|']')}:metrics"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="krzysztof_hoja_0-1712649028921.png" style="width: 801px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/18759i197720C71CF3B8A4/image-dimensions/801x165?v=v2" width="801" height="165" role="button" title="krzysztof_hoja_0-1712649028921.png" alt="krzysztof_hoja_0-1712649028921.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kris&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 09 Apr 2024 07:51:32 GMT</pubDate>
    <dc:creator>krzysztof_hoja</dc:creator>
    <dc:date>2024-04-09T07:51:32Z</dc:date>
    <item>
      <title>Parse JSON in Dynatrace DQL Queries</title>
      <link>https://community.dynatrace.com/t5/DQL/Parse-JSON-in-Dynatrace-DQL-Queries/m-p/242105#M803</link>
      <description>&lt;P&gt;&lt;EM&gt;Summary:&amp;nbsp;Dynatrace Query Language (DQL) supports JSON parsing for logs and events. This thread shows how to extract fields, handle arrays, and apply filters for advanced analytics.&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;Hi All,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need some help as I am trying to extract the below name : value pairs from a bizevent that I have setup but can't seem to be able to do this?&lt;/P&gt;
&lt;P&gt;{ "details": [ { "timestamp": "2020-04-05T18:05:21+05:30", "talktome": "", "type": "issues", "Metrics": [ { "name": "PLATFORM", "value": "windows" }, { "name": "HOST", "value": "1111111" }, { "name": "VERSION", "value": "100" } ] } ] }&lt;/P&gt;
&lt;P&gt;{ "details": [ { "timestamp": "2020-04-05T18:05:21+05:30", "talktome": "", "type": "issues", "Metrics": [ { "name": "PLATFORM", "value": "ios" }, { "name": "HOST", "value": "1111111" }, { "name": "VERSION", "value": "100" } , { "name": "SDK", "value": "1.23" }] } ] }&lt;/P&gt;
&lt;P&gt;Please could someone assist with a query that can pull the&amp;nbsp;Metrics name : value pair whereby the Metrics name value on both the examples above will be satisfied&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PLATFORM = windows ,&amp;nbsp;HOST =&amp;nbsp;1111111,&amp;nbsp;VERSION=100&lt;/P&gt;
&lt;P&gt;PLATFORM = ios,&amp;nbsp;HOST =&amp;nbsp;1111111,&amp;nbsp;VERSION=100,&amp;nbsp;SDK=1.23&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Dec 2025 07:41:09 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Parse-JSON-in-Dynatrace-DQL-Queries/m-p/242105#M803</guid>
      <dc:creator>brett_schubach1</dc:creator>
      <dc:date>2025-12-09T07:41:09Z</dc:date>
    </item>
    <item>
      <title>Re: Json parsing in DQL</title>
      <link>https://community.dynatrace.com/t5/DQL/Parse-JSON-in-Dynatrace-DQL-Queries/m-p/242126#M804</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/38550"&gt;@brett_schubach1&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;I really don't understand what exactly you want to get. In this example, with the same data, I could get all the values on new fields.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;data record(data="""{"details":[{"timestamp": "2020-04-05T18:05:21+05:30","event_1": "","type": "business","Metrics": [ { "name": "PLATFORM", "value": "windows" }, { "name": "HOST", "value": "1111111" }, { "name": "VERSION", "value": "100" } ] } ]}"""),
     record(data="""{ "details": [ { "timestamp": "2020-04-05T18:05:21+05:30", "talktome": "", "type": "issues", "Metrics": [ { "name": "PLATFORM", "value": "ios" }, { "name": "HOST", "value": "1111111" }, { "name": "VERSION", "value": "100" } , { "name": "SDK", "value": "1.23" }] } ] }""")
| parse data, "JSON:json"
| fieldsFlatten json
| fields timestamp = json.details[0][timestamp],type =  json.details[0][type], metrics=json.details[0][Metrics]
| fieldsAdd metrics_str = toString(metrics)
| expand metrics
| fieldsAdd name=metrics[name],value=metrics[value]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Results:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="cesarsaravia_1-1712614992910.png" style="width: 632px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/18752i7E30D77942849120/image-dimensions/632x180?v=v2" width="632" height="180" role="button" title="cesarsaravia_1-1712614992910.png" alt="cesarsaravia_1-1712614992910.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I think if you want to get all those values on the same field, maybe you need to user the &lt;A href="https://docs.dynatrace.com/docs/shortlink/dpl-key-value-pairs" target="_self"&gt;KVP (Key value pairs) Pattern&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2024 22:23:25 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Parse-JSON-in-Dynatrace-DQL-Queries/m-p/242126#M804</guid>
      <dc:creator>cesarsaravia</dc:creator>
      <dc:date>2024-04-08T22:23:25Z</dc:date>
    </item>
    <item>
      <title>Re: Json parsing in DQL</title>
      <link>https://community.dynatrace.com/t5/DQL/Parse-JSON-in-Dynatrace-DQL-Queries/m-p/242148#M805</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/30478"&gt;@cesarsaravia&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the above will try it out. You are correct I want all the data per record on the same line in the table. Appreciate the assistance and guidance.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2024 07:18:28 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Parse-JSON-in-Dynatrace-DQL-Queries/m-p/242148#M805</guid>
      <dc:creator>brett_schubach1</dc:creator>
      <dc:date>2024-04-09T07:18:28Z</dc:date>
    </item>
    <item>
      <title>Re: Json parsing in DQL</title>
      <link>https://community.dynatrace.com/t5/DQL/Parse-JSON-in-Dynatrace-DQL-Queries/m-p/242156#M806</link>
      <description>&lt;P&gt;KVP is something to use, but due to what formatting valid JSON allows it is hard to express the pattern in the way it will always work independently e.g. how many blanks or new lines are between elements. I tried to be as generic as possible with it (but still assumed that "name" comes before "value"):&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;data record(data="""{"details":[{"timestamp": "2020-04-05T18:05:21+05:30","event_1": "","type": "business","Metrics": [ { "name": "PLATFORM", "value": "windows" }, { "name": "HOST", "value": "1111111" }, { "name": "VERSION", "value": "100" } ] } ]}"""),
     record(data="""{ "details": [ { "timestamp": "2020-04-05T18:05:21+05:31", "talktome": "", "type": "issues", "Metrics": [ { "name": "PLATFORM", "value": "ios" }, { "name": "HOST", "value": "1111111" }, { "name": "VERSION", "value": "100" } , { "name": "SDK", "value": "1.23" }] } ] }""")
| parse data, "DATA '\"Metrics\":' SPACE* '[' KVP{ SPACE* '{' SPACE* DQS ':' SPACE* DQS:key SPACE* ',' SPACE* DQS ':' SPACE* DQS:value SPACE* '}' SPACE* (','|']')}:metrics"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="krzysztof_hoja_0-1712649028921.png" style="width: 801px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/18759i197720C71CF3B8A4/image-dimensions/801x165?v=v2" width="801" height="165" role="button" title="krzysztof_hoja_0-1712649028921.png" alt="krzysztof_hoja_0-1712649028921.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kris&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2024 07:51:32 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Parse-JSON-in-Dynatrace-DQL-Queries/m-p/242156#M806</guid>
      <dc:creator>krzysztof_hoja</dc:creator>
      <dc:date>2024-04-09T07:51:32Z</dc:date>
    </item>
  </channel>
</rss>

