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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
cmht
Regular Visitor

API connect - We found extra characters at the end of JSON input

Hello,

I have a problem, I get an error:

DataFormat.Error: We found extra characters at the end of JSON input.

Details:

Value=

Position=0

 

and this is about action =Json.Dcoument(GetJson)

 

Here my code:

let
authKey ="Basic " & AconexAuthorizationPair, //100% works

//Retrieve token from Aconex
GetJson =
Web.Contents(
"https://eu1.aconex.com/api/projects/XXXXXXXXXX/register",
[
Headers=[
#"Accept"="application/xml",
#"X-Application-Key"=AconexIntegrationID,
#"Authorization"=authKey
],
Query=[
#"search_query"="doctype:Plan",
#"return_fields"="trackingid,title,doctype,docno,attribute1,forreview,filename,fileType,fileSize"]
]
),

FromatAsJson = Json.Document(GetJson),

//Extract token from Json response
AccessToken = FromatAsJson[access_token]

in
AccessToken
 
Please let me know what I am doing wrong, below a Power Automate action which works:
cmht_0-1706871126484.png

 

of course above in Power Automate I just provide normal username and password, with PowerBI it is in a Base64 format username:password - but this works.

 

I think there is no token exchange, I have this code as I found it somewhere in connections with OAuth2 for Spotify, here I just need a plain JSON response, I think problem is caused after Web.Contents -> and this is a place where I don't knwo what to do.

 

Any help would be appreciated.

1 ACCEPTED SOLUTION
cmht
Regular Visitor

Hi,

I solved the issue by changing the Query, as it is not JSON -> it gives back valid XML in binary.

Now everything works.

View solution in original post

2 REPLIES 2
cmht
Regular Visitor

Hi,

I solved the issue by changing the Query, as it is not JSON -> it gives back valid XML in binary.

Now everything works.

lbendlin
Super User
Super User

Instead of attempting to parse the JSON, have a look at the raw output that comes back.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.