Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Vienna from September 15-18, 2025, for the ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM. Get registered

Reply
NunoTrigo1986
Helper I
Helper I

reading json file without using RDD on fabric

Hei, 

 

Since i am working with json-stat2 files, and after trying to handle it using only spark frataframes didnt work, I want to extract it in the traditional way using  pyjstat on python. 

 

First i need to read json file as a string og text. I tried 

 

 

import json

# Define the path to the JSON file
path = "your_path_here"

# Open the JSON file and read its content
with open(path1, "r") as file:
    content = file.read()

# Print the content of the JSON file
print(content)

 

But i get an error that says no file is identified ( No such file or directory:) on the given path.

But if I use 

 

json_data = sc.textFile(path1).first()

 

 with same path it works perfectly. 

 

Why ? 

 

I need to get several tables from Norwegian Statistics bureau. 

If you wanna try their API,  (you get an example below). My goal is to create temViews after changing from pandas to spark dataframe

 

table_05327 = "https://data.ssb.no/api/v0/no/table/05327/"
query_05327 ={"query":[],"response":{"format":"json-stat2"}}
resultat = requests.post(table_05327, json = query_05327)
dataset = pyjstat.Dataset.read(resultat.text)
df = dataset.write('dataframe')

 

Usin native pyspark it seems impossibel to handle since original order of values and categories are changed due to maptype that dont preservs order in the structure of json. 

1 ACCEPTED SOLUTION

Hi and thanks foryour reply. I did not manage "with open...." syntax to work, but since i found a workaround I did not create a asupport tickect. Thanks again for your assistance. 

View solution in original post

5 REPLIES 5
michalikmaciek
New Member

Hi,

Where are your files stored ? 

on the lakehouse 🙂

Anonymous
Not applicable

Hi @NunoTrigo1986 
We haven’t heard from you on the last response and was just checking back to see if you got a chance to create support ticket. If yes please share the details here. Otherwise, will respond back with the more details and we will try to help.
Thanks

Hi and thanks foryour reply. I did not manage "with open...." syntax to work, but since i found a workaround I did not create a asupport tickect. Thanks again for your assistance. 

Anonymous
Not applicable

Hi @NunoTrigo1986 
Thanks for using Fabric Community.

The best course of action is to open a support ticket and have our support team take a closer look at it.

Please reach out to our support team so they can do a more thorough investigation on why this it is happening: Link 

After creating a Support ticket please provide the ticket number as it would help us to track for more information.

 

Hope this helps. Please let us know if you have any other queries.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June FBC25 Carousel

Fabric Monthly Update - June 2025

Check out the June 2025 Fabric update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.