Forum Discussion

EPetit's avatar
EPetit
Regular Visitor
5 years ago
Solved

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

Hello,

 

I got this problem when I connect PBI with API Rest using Web.contents()

 

I don't understand what happened. Someone can explain to me ?

 

Here my code :

 

let
    Source = Json.Document(Web.Contents("xxx", 
    [
        RelativePath = "xxx",
        Content=Text.ToBinary(""),
        Headers=[#"Content-Type"="application/json", 
        Authorization="Bearer xxx"
        ]  
    ]))
    
in
    Source

 

 

Thanks !

  • Hi EPetit 

    It should be #"Authorization" in Headers 

     

    let
        Source = Json.Document(Web.Contents("xxx", 
        [
            RelativePath = "xxx",
            Content=Text.ToBinary(""),
            Headers=[#"Content-Type"="application/json", 
            #"Authorization"="Bearer xxx"
            ]  
        ]))
        
    in
        Source

     

    Phil


    If I answered your question please mark my post as the solution.
    If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.

2 Replies

  • Hi EPetit 

    It should be #"Authorization" in Headers 

     

    let
        Source = Json.Document(Web.Contents("xxx", 
        [
            RelativePath = "xxx",
            Content=Text.ToBinary(""),
            Headers=[#"Content-Type"="application/json", 
            #"Authorization"="Bearer xxx"
            ]  
        ]))
        
    in
        Source

     

    Phil


    If I answered your question please mark my post as the solution.
    If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.