# How to process json data correctly in dremio?

**URL:** <https://community.dremio.com/t/how-to-process-json-data-correctly-in-dremio/11586>\
**Category:** Uncategorized\
**Created:** [March 4, 2024, 1:48pm UTC](https://community.dremio.com/t/how-to-process-json-data-correctly-in-dremio/11586 "2024-03-04T13:48:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![skantor](https://avatars.discourse-cdn.com/v4/letter/s/c77e96/32.png) [@skantor](https://community.dremio.com/u/skantor)\
**Post date:** [March 4, 2024, 1:48pm UTC](https://community.dremio.com/t/how-to-process-json-data-correctly-in-dremio/11586/1 "2024-03-04T13:48:13Z")

</div>

Hello!

I’m new to dremio and can’t figure out how to work with json correctly.  
For example - I have data in S3 (parquet) in dremio they are displayed as text.  
Accordingly, I need to reformat to json(struct) - but how to do it correctly?

For example, if I do something like this, it takes a long time (I have about 3 million lines).(And it’s not always fulfilled to the end)

SELECT a, b, c, d convert\_from(nested\_0.“e”, ‘JSON’) AS “e\_json”  
FROM (  
select \* from my\_table  
) nested\_0

Is there any better way to do it?

---

<div class="post-metadata">

**Author:** ![balaji.ramaswamy](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/balaji.ramaswamy/32/843_2.png) [@balaji.ramaswamy](https://community.dremio.com/u/balaji.ramaswamy)\
**Post date:** [March 5, 2024, 6:30am UTC](https://community.dremio.com/t/how-to-process-json-data-correctly-in-dremio/11586/2 "2024-03-05T06:30:48Z")

</div>

@skantor If the file format is Parquet and you have array of structs, you can directly flatten the array and extract the element from the resulting struct. No need to convert to JSON

```auto
SELECT fragmentProfile, nested_0.fragmentProfile.majorFragmentId AS majorFragmentId
FROM (
  SELECT FLATTEN("profile_attempt_0"."fragmentProfile") AS fragmentProfile
  FROM "@dremio".profile_attempt_0 AS profile_attempt_0
) nested_0;

```
