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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
hmeltonPSL
Helper I
Helper I

We found extra characters at the end of JSON input

I am trying to write the following query so I can include project description from azure devops in my powerbi report.  The URL works fine on its own and get JSON back..howver when I put it in the following function in POwerBI I get the error below.  

 

Any ideas?  thanks

 

= (projectid as text) as binary =>
let
Source = Json.Document(Web.Contents("https://dev.azure.com/ORGNAME/_apis/projects/" & projectid & "?api-version=6.0"))
in
Source

 

 

An error occurred in the ‘’ query. DataFormat.Error: We found extra characters at the end of JSON input.
Details:
Value=
Position=4

2 REPLIES 2
v-jingzhang
Community Support
Community Support

Hi @hmeltonPSL 

 

Since "The URL works fine on its own and get JSON back", you can try using Web connector in Power Query Editor to connect to this URL and test whether it can get the result back. You will need to enter credentials before connecting successfully. Power Query will detect the format of the data it gets and convert it to JSON format automatically. 

 

If you can get correct result from the URL through Web connector, then you can use a query paramter to replace the projectid part in the URL. At last, in Queries pane, right click on the query and select option Create Function. This method is to use UI to create a function. You can compare its M codes and your codes to see which the difference is that may cause the error.

 

Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it. Kudos are also appreciated. Thanks!

ImkeF
Super User
Super User

Hi @hmeltonPSL ,

nothing obvious comes to my mind here. 

I would debug as follows:

1) remove the "as binary" from the function:

 

(projectid as text)  =>
let
Source = Json.Document(Web.Contents("https://dev.azure.com/ORGNAME/_apis/projects/" & projectid & "?api-version=6.0"))
in
Source

 


2) if 1) doesn't help, then run the function without Json - conversion:

 

 

(projectid as text)  =>
let
Source = Web.Contents("https://dev.azure.com/ORGNAME/_apis/projects/" & projectid & "?api-version=6.0")
in
Source

 

You can then parse the result in a separate step/column with the "Text.FromBinary"-function and try to figure out what's wrong with the JSON.

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors