Forum Discussion
Json.FromValue
Another error:(
Expression.Error: Invalid binary encoding.
Details:
{Period:{Begin:"1584428676205",End:"1584515076205"},TargetObject:{ObjectTypeId:"0F1E3A4A-88F5-4166-9BE8-76033DD85D08",ObjectId:"51005"}}
Hi Bessonnizza ,
I see no reason why Json.FromValue should not work.
Please try the following:
Json.FromValue(
[
Period = [
Begin = "1584428676205",
End = "1584515076205"
],
TargetObject = [
ObjectID = "51005",
ObjectTypeId = "0F1E3A4A-88F5-4166-9BE8-76033DD85D08"
]
]
)
- ImkeF6 years agoCommunity Champion
Hi lbendlin ,
you might bi interested in this little article that I wrote some time ago: https://www.thebiccountant.com/2018/06/05/easy-post-requests-with-power-bi-and-power-query-using-json-fromvalue/
- Bessonnizza6 years agoHelper II
if i use json.fromvalue:
An error occurred in the ‘fnStartStatisticsSession’ query. DataSource.Error: Web.Contents failed to get contents from 'http://spic.scout365.ru:8081/spic/StatisticsController/rest/StartStatisticsSession' (500): Internal Server Error
Details:
DataSourceKind=Web
DataSourcePath=http://spic.scout365.ru:8081/spic/StatisticsController/rest/StartStatisticsSession
Url=http://spic.scout365.ru:8081/spic/StatisticsController/rest/StartStatisticsSession - ImkeF6 years agoCommunity Champion
Hi Bessonnizza ,
I'd recommend to lookup in the API specification of your source (spic.scout365) what the reasons for a 500 error could be.
- ImkeF6 years agoCommunity Champion
... just saw that Begin and End are the same - maybe that is the reason?
- lbendlin6 years agoSuper User
Either try Text.ToBinary or encode the text with Base64 before feeding it to the Binary.FromText function.
- ImkeF6 years agoCommunity Champion
Hi lbendlin ,
is there any specific reason why you're not working with the Json.FromValue function?
To my understanding it is just the fitting function here and doesn't require all this escaping that can quickly lead to errors.The Json.FromValue function also allows for different encodings in the optional 2nd parameter.