# How to parse data into json once more

**URL:** <https://community.grafana.com/t/how-to-parse-data-into-json-once-more/88235>\
**Category:** Grafana Loki\
**Tags:** logql\
**Created:** [May 24, 2023, 8:01am UTC](https://community.grafana.com/t/how-to-parse-data-into-json-once-more/88235 "2023-05-24T08:01:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![leelax22](https://avatars.discourse-cdn.com/v4/letter/l/7bcc69/32.png) [@leelax22](https://community.grafana.com/u/leelax22)\
**Post date:** [May 24, 2023, 8:01am UTC](https://community.grafana.com/t/how-to-parse-data-into-json-once-more/88235/1 "2023-05-24T08:01:07Z")

</div>

![image](https://us1.discourse-cdn.com/grafana/original/3X/4/2/42a899766b6304977809cc470e9f214f0eb5f891.png)

In the screenshot I uploaded, I parsed the data into json once and got the key and value in the field, but since the log entries [properties\_log] are in json, I want to parse them once again, so how can I manipulate them?

---

<div class="post-metadata">

**Author:** ![tonyswumac](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/tonyswumac/32/22401_2.png) [@tonyswumac](https://community.grafana.com/u/tonyswumac)\
**Post date:** [May 25, 2023, 4:27pm UTC](https://community.grafana.com/t/how-to-parse-data-into-json-once-more/88235/2 "2023-05-25T16:27:43Z")

</div>

You might try something like this:

```auto
{<LABEL_SELECTOR>} | JSON | line_format "{{.log}}" | JSON

```

I would recommend you to adjust your log ingestion a bit though. Looking at your screenshot, it seems that your real “log” is in the field `properties.log` (similar to what one might see from Docker log driver, where the actual log is enclosed in a subfield with other JSON keys that provide metadata), so you should try to preserve that, meaning your log line should be just that.

So I’d recommend to parse your log line a little bit on the ingestion agent, turn all the top level keys into labels (and get rid of the ones you don’t care about as well), and use the `property.log` as your message body. It’ll make your logs much cleaner on Loki, and easier to parse. Just my opinions.

---

<div class="post-metadata">

**Author:** ![leelax22](https://avatars.discourse-cdn.com/v4/letter/l/7bcc69/32.png) [@leelax22](https://community.grafana.com/u/leelax22)\
**Post date:** [May 26, 2023, 3:17am UTC](https://community.grafana.com/t/how-to-parse-data-into-json-once-more/88235/3 "2023-05-26T03:17:48Z")

</div>

Thank you for your response. I’m trying grafana agent flow as the injection agent and re-labeling it. I’ll have to try line\_format as well, it seems to be quite tricky. Thanks so much for the insight.

---

<div class="post-metadata">

**Author:** ![anon74857911](https://avatars.discourse-cdn.com/v4/letter/a/8edcca/32.png) [@anon74857911](https://community.grafana.com/u/anon74857911)\
**Post date:** [May 30, 2023, 6:00am UTC](https://community.grafana.com/t/how-to-parse-data-into-json-once-more/88235/4 "2023-05-30T06:00:38Z")

</div>

`JSON` is not a valid LogQL pipeline; it should be `json`.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/grafana/original/2X/e/ef5308cc58c9e5a13187b5012eb99f406928462f.png) [@system](https://community.grafana.com/u/system)\
**Post date:** [May 29, 2024, 6:01am UTC](https://community.grafana.com/t/how-to-parse-data-into-json-once-more/88235/5 "2024-05-29T06:01:25Z")

</div>

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