Forum Discussion
Json.FromValue
Does Parameters works in you case? For example
data = Json.Document("{Period:{Begin:"paramBegin",End:"paramEnd"}Yes, it would work
data = Json.Document("{Period:{Begin:""" & paramBegin & """,End:""" & paramEnd & """},TargetObject:{ObjectId:""" & paramObjectId & """,ObjectTypeId:""" & paramObjectTypeId & """}}")
Don't lose any sleep (pun intended) over the double quotes - they are all needed.
- Bessonnizza6 years agoHelper II
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- lbendlin6 years agoSuper User
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""}}"