Forum Discussion
Ferna
2 years agoFrequent Visitor
Import values from a local json file
Hello all, I'm trying to extract some values from a local json file: confPath = "C:\<path>",
configFile = File.Contents(confPath, BinaryEncoding.Base64) as binary,
configText =...
- 2 years ago
Ferna Maybe this?
let Source = Json.Document(File.Contents("C:\temp\testjson.json")), #"Converted to Table" = Table.FromRecords({Source}), #"Changed Type" = Table.TransformColumnTypes(#"Converted to Table",{{"other_field", type text}, {"url", type text}}) in #"Changed Type"
Ferna
2 years agoFrequent Visitor
It doesn't work, with same error. Also, if you not specify the encoding type, it does not compile: "UnpermittedResourceAccessException". I try also:
File.Contents(confPath, BinaryEncoding.Hex)
but similar error "We cannot convert the value 1 to type Record"
Greg_Deckler
2 years agoCommunity Champion
Ferna It works fine for me. I just took your json and pasted into Notepad and saved as testjson.json. I'm not understanding the binary encoding stuff you are doing. Is your json file not text? I would think it would be text.
- Ferna2 years agoFrequent Visitor
File.Contents(<path>)is not available when you are customizing a data connector (so not authorized to use). I accept as a solution because works in normal conditions.