# Parse failure (object mapping for \[trace.detail\] tried to parse field \[null\] as object, but found a concrete value)

**URL:** <https://discuss.elastic.co/t/parse-failure-object-mapping-for-trace-detail-tried-to-parse-field-null-as-object-but-found-a-concrete-value/336551>\
**Category:** Logstash\
**Created:** [June 21, 2023, 8:26am UTC](https://discuss.elastic.co/t/parse-failure-object-mapping-for-trace-detail-tried-to-parse-field-null-as-object-but-found-a-concrete-value/336551 "2023-06-21T08:26:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![a.emrekaraman](https://avatars.discourse-cdn.com/v4/letter/a/bc79bd/32.png) [@a.emrekaraman](https://discuss.elastic.co/u/a.emrekaraman)\
**Post date:** [June 21, 2023, 8:26am UTC](https://discuss.elastic.co/t/parse-failure-object-mapping-for-trace-detail-tried-to-parse-field-null-as-object-but-found-a-concrete-value/336551/1 "2023-06-21T08:26:18Z")

</div>

Hi Team, I basically use json filter to parse log. But somewhere in json have 2 different type of log that's why I get this error (object mapping for [trace.detail] tried to parse field [null] as object, but found a concrete value).

I found where the issue is but not able to fix it. I need support your support 🙂

Problematic part of the log; ( in detail : Account not found. square brackets cause this parse error. )

"trace": [  
{  
"action": "LOGIN",  
"detail": {  
"email": "[kervanbebe@yaani.com](mailto:kervanbebe@yaani.com)"  
},  
"level": 200,  
"time": 1687292346  
},  
{  
"action": "FORM\_INPUTS",  
"detail": {  
"email": "[kervanbebe@yaani.com](mailto:kervanbebe@yaani.com)"  
},  
"level": 500,  
"time": 1687292346  
},  
{  
"action": "LOGIN\_ERROR",  
"detail": [  
"Account not found."  
],  
"level": 500,  
"time": 1687292346  
}  
],

I tried to split,remove this field but not able to that.

Thanks for help in advance.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [June 21, 2023, 7:20pm UTC](https://discuss.elastic.co/t/parse-failure-object-mapping-for-trace-detail-tried-to-parse-field-null-as-object-but-found-a-concrete-value/336551/2 "2023-06-21T19:20:17Z")

</div>

I would fix that using a ruby filter. You could try

```
    ruby {
        code => '
            trace = event.get("trace")
            if trace.is_a? Array
                trace.each_index { |i|
                    if trace[i]["detail"].is_a? Array
                        event.set("[trace][#{i}][detail]", { "status" => trace[i]["detail"][0] } )
                    end
                }
            end
        '
    }

```

so that you end up with

```
    [2] {
        "detail" => {
            "status" => "Account not found."
        },
        "action" => "LOGIN_ERROR",
         "level" => 500,
          "time" => 1687292346
    }

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 19, 2023, 7:20pm UTC](https://discuss.elastic.co/t/parse-failure-object-mapping-for-trace-detail-tried-to-parse-field-null-as-object-but-found-a-concrete-value/336551/3 "2023-07-19T19:20:57Z")

</div>

Closed on July 19, 2023, 7:20pm UTC

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