# DQL parsing Json and extracting new column

**URL:** <https://community.dynatrace.com/t/dql-parsing-json-and-extracting-new-column/47112>\
**Category:** DQL\
**Tags:** dql, logs, dpl\
**Created:** [August 12, 2024, 12:49pm UTC](https://community.dynatrace.com/t/dql-parsing-json-and-extracting-new-column/47112 "2024-08-12T12:49:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![y\_buccellato](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/y_buccellato/32/160_2.png) [@y\_buccellato](https://community.dynatrace.com/u/y_buccellato)\
**Post date:** [August 12, 2024, 12:49pm UTC](https://community.dynatrace.com/t/dql-parsing-json-and-extracting-new-column/47112/1 "2024-08-12T12:49:32Z")

</div>

Good afternoon community,

in my log line I have a field called:

custom\_headers

 ![y_buccellato_1-1723466812323.png](https://global.discourse-cdn.com/dynatrace/original/3X/b/5/b572516082efa5b5fc2d8f680685c8f7bc1b83c6.png)

custom headers contains this value:

{“id”:“261004620”,“name”:“OrderId”,“value”:“5602867201”},  
{“id”:“260996569”,“name”:“xxxxother”,“value”:“xxxxxx”}

out of all of it I’d like to extract and keep:

**OrderId** &nbsp;as the name of the column&nbsp;and then each row to be the actual id (“value”:“56xxxxx”)

Reviewed DPL/DQL but things are quite complex,  
thanks for any help here,

regards,

Yann

---

<div class="post-metadata">

**Author:** ![y\_buccellato](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/y_buccellato/32/160_2.png) [@y\_buccellato](https://community.dynatrace.com/u/y_buccellato)\
**Post date:** [August 13, 2024, 1:56pm UTC](https://community.dynatrace.com/t/dql-parsing-json-and-extracting-new-column/47112/2 "2024-08-13T13:56:42Z")

</div>

Thanks to internal Dynatrace help I was able to solve this.

The new Processor worked like this:

parse custom\_headers[0],“JSON:temp1”  
|parse custom\_headers[1],“JSON:temp2”  
|fieldsAdd SalesOrderId = if(temp1[name] == “SalesOrderId”,temp1[value],else:temp2[value])

The two first line defines separate Json from the whole array (the one in position [0] and the on in [1]).  
The last line adds a field called SalesOrderID and the value will match&nbsp;&nbsp;temp1[value] if&nbsp;temp1[name] == “SalesOrderId” or will match&nbsp;temp2[value]&nbsp; if&nbsp;temp1[name] will not be"SalesOrderId".

Regards
