# How to structure into JSON unstructured STRING data with Lenses SQL?

**URL:** <https://ask.lenses.io/t/how-to-structure-into-json-unstructured-string-data-with-lenses-sql/74>\
**Category:** Lenses\
**Created:** [May 30, 2023, 9:09pm UTC](https://ask.lenses.io/t/how-to-structure-into-json-unstructured-string-data-with-lenses-sql/74 "2023-05-30T21:09:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![stefanbot](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@stefanbot](https://ask.lenses.io/u/stefanbot)\
**Post date:** [May 30, 2023, 9:09pm UTC](https://ask.lenses.io/t/how-to-structure-into-json-unstructured-string-data-with-lenses-sql/74/1 "2023-05-30T21:09:13Z")

</div>

I have unstructured events such as a STRING in a Kafka topic. Such as this:

```auto
SSM
LT
07APR00001C001
RPL
UA024
17MAY22 03JUN22 1234567
J 76L J55O11Y99
LHR1110 EWR1622
QQAAWR 97/C
LHRAQQ 99/2

```

Can I process and structure it using Regex into JSON/AVRO/PROTOBUF in a streaming SQL application?

---

<div class="post-metadata">

**Author:** ![guillaume.ayme](https://dub1.discourse-cdn.com/flex017/user_avatar/ask.lenses.io/guillaume.ayme/32/64_2.png) [@guillaume.ayme](https://ask.lenses.io/u/guillaume.ayme)\
**Post date:** [May 30, 2023, 9:22pm UTC](https://ask.lenses.io/t/how-to-structure-into-json-unstructured-string-data-with-lenses-sql/74/2 "2023-05-30T21:22:15Z")

</div>

You can use the `REGEX` function in the Lenses SQL engine to extract the field. Such as:

```auto
INSERT INTO myTargetTopic
   SELECT STREAM
      REGEX(_value, "[A-Z]+") as myField,
      FROM mySourceTopic

```
