JSON Splits working in ETL preview, but show different results in dataset

Hello!
I have created a handful of column splits that preview perfectly in the ELT; however, once I RUN→Dataset, the results are off.
Example of JSON
FieldValue{attribute=PRIMITIVE, value=Known}, FieldValue{attribute=PRIMITIVE, value=1663001799.0}, FieldValue{attribute=PRIMITIVE, value=100.0},
Answers
-
You are splitting the string by comma. Replacing value equals with actual values. This may work in the preview because the data is consistent. But in execution you will have inconsistent field structures like extra spaces, missing fields, extra commas, new line variations, etc.
You might try trimming whitespaces after splitting.TRIM(`Stage Name`)
Use regular expressions for extracting data instead of splitting it on commas.
value=([^}]+)
You may also have inconsistent field counts. Some rows may have more or less entries. When working with JSON, I try to handle the extraction as real JSON rather that treating it as text and "grab" bits out of the string. To actually parse the JSON for values. In a Python tile for example, something like this:
import re
import pandas as pd
def process(df):
def extract_values(row):
matches = re.findall(r'value=([^}]+)', row)
return pd.Series(matches)
df[['Stage Name', 'Stage Timestamp', 'Score']] = df['stage'].apply(extract_values)
return df** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0
Categories
- All Categories
- Product Ideas
- 2.1K Ideas Exchange
- Connect
- 1.3K Connectors
- 309 Workbench
- 7 Cloud Amplifier
- 10 Federated
- Transform
- 664 Datasets
- 120 SQL DataFlows
- 2.3K Magic ETL
- 825 Beast Mode
- Visualize
- 2.6K Charting
- 88 App Studio
- 46 Variables
- Automate
- 195 Apps
- 486 APIs & Domo Developer
- 94 Workflows
- 24 Code Engine
- AI and Machine Learning
- 23 AI Chat
- 4 AI Projects and Models
- 18 Jupyter Workspaces
- Distribute
- 119 Domo Everywhere
- 283 Scheduled Reports
- 11 Software Integrations
- Manage
- 143 Governance & Security
- 11 Domo Community Gallery
- 49 Product Releases
- 13 Domo University
- Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 116 Community Announcements
- 5K Archive