# JSON parse failure

**URL:** <https://discuss.elastic.co/t/json-parse-failure/118356>\
**Category:** Logstash\
**Created:** [February 4, 2018, 6:21pm UTC](https://discuss.elastic.co/t/json-parse-failure/118356 "2018-02-04T18:21:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shyam\_Burla](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@Shyam\_Burla](https://discuss.elastic.co/u/Shyam_Burla)\
**Post date:** [February 4, 2018, 6:21pm UTC](https://discuss.elastic.co/t/json-parse-failure/118356/1 "2018-02-04T18:21:37Z")

</div>

I trying to parse log message which is below..  
{  
"records":  
[

```
	{
		 "ActivityId": "XXX",
		 "EventName": "XXX",
		 "resourceId": "XXXX",
		 "SubscriptionId": "XXXXX",
		 "EventTimeString": "XXXXX",
		 "EventProperties": "{\"SubscriptionId\":\"XXX\",\"Namespace\":\"ehnamespace\",\"Via\":\"XXX\",\"TrackingId\":\"XX\"}",
		 "Status": "XXX",
		 "Caller": "XXXX",
		 "category": "XXXX"
	}

```

I'm able to parse all the other fields but for EventProperties I 'm not able to split the fields.

This is my logstash syntax  
split  
{  
field =\> "records"  
add\_field =\> {  
"EventTime" =\> "%{[records][EventTimeString]}"  
"EventName" =\> "%{[records][EventName]}"  
"ActivityId" =\> "%{[records][ActivityId]}"  
"SubscriptionId" =\> "%{[records][SubscriptionId]}"  
"Namespace" =\> "%{[records][EventProperties][Namespace]}"  
"Status" =\> "%{[records][Status]}"  
"Caller" =\> "%{[records][Caller]}"  
"category" =\> "%{[records][category]}"  
}

```
     # remove_field => ["records"]
  }

```

I'm looking to parse the namespace field properly.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [February 4, 2018, 10:10pm UTC](https://discuss.elastic.co/t/json-parse-failure/118356/2 "2018-02-04T22:10:57Z")

</div>

The contents of `EventProperties` is a JSON string. Use a json filter to parse it.

---

<div class="post-metadata">

**Author:** ![Shyam\_Burla](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@Shyam\_Burla](https://discuss.elastic.co/u/Shyam_Burla)\
**Post date:** [February 5, 2018, 10:56pm UTC](https://discuss.elastic.co/t/json-parse-failure/118356/3 "2018-02-05T22:56:55Z")

</div>

Thanks, It Works

---

<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:** [March 5, 2018, 10:57pm UTC](https://discuss.elastic.co/t/json-parse-failure/118356/4 "2018-03-05T22:57:39Z")

</div>

Closed on March 5, 2018, 10:57pm UTC

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