Forum Discussion
Json.FromValue
try you example and get an error:
Expression.Error: We cannot convert a value of type Record to type Binary.
Details:
Value=[Record]
Type=[Type]
let
data = Json.Document("{Period:{Begin:""1584428676205"",End:""1584515076205""},TargetObject:{ObjectId:""51005"",ObjectTypeId:""0F1E3A4A-88F5-4166-9BE8-76033DD85D08""}}"),
headers = [#"accept"="*/*", #"ScoutAuthorization"=paramAuthorizationId, #"Content-Type"="application/json"],
web = Web.Contents("http://url", [ Content = data, Headers = headers, ManualStatusHandling = {404, 400}]),
result = Json.Document(web)
in
result
How about this?
let
data = "{Period:{Begin:""1584428676205"",End:""1584515076205""},TargetObject:{ObjectId:""51005"",ObjectTypeId:""0F1E3A4A-88F5-4166-9BE8-76033DD85D08""}}",
headers = [#"accept"="*/*", #"ScoutAuthorization"=paramAuthorizationId, #"Content-Type"="application/json"],
web = Web.Contents("http://url", [ Content = data, Headers = headers, ManualStatusHandling = {404, 400}]),
result = Json.Document(web)
in
result- Bessonnizza6 years agoHelper II
Get another error:
Expression.Error: We cannot convert the value "{Period:{Begin:"1584..." to type Binary.
Details:
Value={Period:{Begin:"1584428676205",End:"1584515076205"},TargetObject:{ObjectId:"51005",ObjectTypeId:"0F1E3A4A-88F5-4166-9BE8-76033DD85D08"}}
Type=[Type]Can you explain me, this expressions is equal to each other or not:
data = Json.FromValue([Begin=1584428676205, End=1584515076205, ObjectTypeId="0F1E3A4A-88F5-4166-9BE8-76033DD85D08", ObjectId=51005]) equal
data = "{Period:{Begin:""1584428676205"",End:""1584515076205""},TargetObject:{ObjectId:""51005"",ObjectTypeId:""0F1E3A4A-88F5-4166-9BE8-76033DD85D08""}}"
- lbendlin6 years agoSuper User
How about this one?
let data = Binary.FromText("{Period:{Begin:""1584428676205"",End:""1584515076205""},TargetObject:{ObjectId:""51005"",ObjectTypeId:""0F1E3A4A-88F5-4166-9BE8-76033DD85D08""}}"), headers = [#"accept"="*/*", #"ScoutAuthorization"=paramAuthorizationId, #"Content-Type"="application/json"], web = Web.Contents("http://url", [ Content = data, Headers = headers, ManualStatusHandling = {404, 400}]), result = Json.Document(web) in result- Bessonnizza6 years agoHelper II
Another error:(
Expression.Error: Invalid binary encoding.
Details:
{Period:{Begin:"1584428676205",End:"1584515076205"},TargetObject:{ObjectTypeId:"0F1E3A4A-88F5-4166-9BE8-76033DD85D08",ObjectId:"51005"}}- ImkeF6 years agoCommunity Champion
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" ] ] )