I have and string array in json format as follows, which I will be adding to my API header
[\"Authorization:\ Basic\ T1BFTlZJRFVBUFA6UmVzcG9uc2VARXllITIz\"]
But I get the below error when I try to restart my server which has the above property set in .env file
Property OPENVIDU_WEBHOOK_HEADERS=[\"Authorization:\ Basic
T1BFTlZJRFVBUFA6UmVzcG9uc2VARXllITIz\"]. Is not a valid strings array
in JSON format. com.google.gson.stream.MalformedJsonException:
Expected value at line 1 column 2 path $[0]
What would be the correct way to define the property?
It is to do with the escaping of your string.
Correct String :
["Authorization: \"Basic T1BFTlZJRFVBUFA6UmVzcG9uc2VARXllITIz\""]
Related
I have a requirement to slice "Dev" from below variable vmName in Azure logicapp
variable information :
Name : vmName
Type : String
Value : Dev-Testing-2
When i tried with below approach/expression :
slice(split(variables('dsvmName'),'-'),1)
error : The template language function 'slice' expects its first parameter to be of type string. The provided value is of type 'Array'. Please see https://aka.ms/logicexpressions#slice for usage details.'.
Try this (untested) ...
split(variables('dsvmName'),'-')?[0]
That will retrieve the first item in the array when you split it by a hyphen.
I have reproduced in my environment and got expected results and followed below process:
Firstly, I have taken a http trigger and then initialized as below:
Then, again I initialized as below:
indexOf(variables('vmName'), '-')
Then again initialized as below to get output:
substring(variables('vmName'),0, int(variables('emo')))
Output:
I have created a Logic App that converts XML to JSON
LogicAppProcess
This work 'great', no issues in that part of the process - however, this retains some ? and # symbols within some of the column names. This is then not working downstream in an Azure Data Flow as the # symbol is being picked up a parameter..
enter image description here
{"code":"BadRequest","message":"ErrorCode=InvalidTemplate, ErrorMessage=Unable to parse expression 'version'","target":"pipeline/PL_XXXX/runid/XXXX","details":null,"error":null}
Any ideas as to how i can either replace the ? and # symbols at the first point in the process (Logic App) or accommodate for these in the Data Flow?
This is how the Data Flow code sees the error in the Script element - the ?xml is not throwing an error but the first # is, and shows #version as the error
"script": "source(output(\n\t\t{?xml} as ({#version} as string, {#encoding} as string),\n\t\trss as ({#version} as string, {#xmlns:cisAbstract} as string...
You can use the replace() function in your logic app to replace the ? and # with null string "". If your data is not string type(such as json object or array or any other type), you can use string() function to convert them to string first and then do the replace() function. Shown as below expression:
replace(replace(string(<your data>), '#', ''), '?', '')
i am using laravel 5.2 and trying to update records using whereIn('id',[1,2]) but when i try to pass a json value [1,2] to it , i returns
parameterize() must be of the type array, string given. I am mentioning my code below.
$load_id=json_encode($request->chk_load,JSON_NUMERIC_CHECK); // it returns [1,2]
Load::whereIn('id',$load_id)->update(array('status'=>3));
What should i do to fix this error. ?
seems json_encode($request->chk_load,JSON_NUMERIC_CHECK);
returns json string and not an array..
can you elaboarate $request->chk_load is what kind of data it is?
Does anyone know how to read this file (array of array, i think??) with retrofit. Can't find any examples on the internet. Have tried
1. ArrayList
2. Collection
3. []
4. [][]
5. List
Error:
Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 3 path $[0]
File:
[[1518173474652,"0.10002000","0.10010300","0.10000100","0.10009300","51.46200000",1518173534651,"5.14685961",86,"27.11500000","2.71207304","0"],[1518173534652,"0.10009300","0.10025000","0.10009300","0.10010800","122.42800000",1518173594651,"12.25782098",123,"20.10800000","2.01471571","0"]]
I think you're parsing it as a JSON, because of the error you received :
Error: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 3 path $[0]
That file, unfortunately, is not a JSON file, it doesn't fulfill the JSON syntax requirement. To check this, copy-paste your file into any JSON formatter online and they can validate it for you.
You could try parsing it with a custom-made converter. Example here.
I have to create XML from Java objects and I use the Simple framework.
My problem is I need to send some names in camel case:
#Element
String ChannelData
and the xml element produced is:
<channel-data>
Which is rejected by the receiver, it needs to be
<channelData>
I cannot find a way to configure this, I tried adding the name explicitly:
#Elenemt(name="channelData")
but without success.
Ok I solved it.
I actuallt initialized the Persister with the wrong format:
Format format = new Format(0, null, new HyphenStyle(), Verbosity.HIGH);
Instead of:
Format format = new Format(0, null, new CamelCaseStyle(), Verbosity.HIGH);