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.
Related
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\""]
I'm having 2 issues when trying to do the create api requests using the jmeter tool
1). How to handle an array parameter. "Versions": "$[Versions]"
getting the following error message
{"timestamp":"2020-02-14T07:18:33.720+0000","status":400,"error":"Bad
Request","message":"JSON parse error: Cannot deserialize instance of
java.util.ArrayList<java.lang.Object> out of VALUE_STRING token;
nested exception is
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot
deserialize instance of java.util.ArrayList<java.lang.Object> out of
VALUE_STRING token\n at [Source: (PushbackInputStream); line: 15,
column: 22]
2). how to handle dynamically created time stamp parameter createtime: "${createtime}"
getting the following error message
{"timestamp":"2020-02-14T07:17:58.942+0000","status":400,"error":"Bad
Request","message":"JSON parse error: Cannot deserialize value of type
java.time.OffsetDateTime from String \"${factoryCompleteTime}\":
Failed to deserialize java.time.OffsetDateTime:
(java.time.format.DateTimeParseException) Text
'${factoryCompleteTime}' could not be parsed at index 0; nested
exception is
com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot
deserialize value of type java.time.OffsetDateTime from String
\"${factoryCompleteTime}\": Failed to deserialize
java.time.OffsetDateTime: (java.time.format.DateTimeParseException)
Text '${factoryCompleteTime}' could not be parsed at index 0\n at
[Source: (PushbackInputStream); line: 15, column: 24]
My json body looks like this.
"Versions": "$[Versions]",
"createtime": "${createtime}"
I think you should pass this Versions a little bit differently, for example if it should be a JSON Array it should look like:
"Versions": [${Versions}],
or
"Versions": ${Versions},
It appears that your ${factoryCompleteTime} variable doesn't have a value so it has been replaced by the default placeholder. Use Debug Sampler and View Results Tree listener combination in order to check the variable value, it should be in format of the OffsetDateTime to wit something like: 2007-12-03T10:15:30+01:00
I am trying to implement the process below with my own data. The data is in a spreadsheet with headers, and the first column has dates, the other columns have returns.
https://inovancetech.com/hmm-tutorial-1.html
My variation on the code:
Returns <- read.csv("MyData.csv",header=TRUE,stringsAsFactor=F)
Date<-as.character(Returns[,1])
DateTS<- as.POSIXlt(Date, format = "%m/%d/%Y")
TSData<-data.frame(Returns[,2:6],row.names=DateTS)
TSData<-as.xts(TSData)
MyReturns <- TSData[-1,1]
ModelData<-data.frame(MyReturns)
set.seed(1)
HMM<-depmix(MyReturns~1,data=ModelData,nstates=2,family=gaussian())
This is where I get an error:
Error in dimnames(cd) <- list(as.character(index(x)), colnames(x)) :
'dimnames' applied to non-array
I can't figure out why. Any hints?
When I ran the code I got no error. However, try this:
HMM<-depmix(list(MyReturns~1),data=ModelData,nstates=2,family=gaussian())
I got a similar error elsewhere because I was sharing the data frame variable name indirectly instead of the data itself.
I'm getting error "Error Error: AddIMRConroller Compile Error: Initial term of field expression must be a concrete SObject: LIST at line 21 column 23" from below line of code .
string[] str1 = imrTable.split('\r\n');
System.debug( str1.length);
In salesforce , we need to use size() method instead of length . this is something different then Java :(
I keep getting the following error :
BadArgumentError: Expected an instance or iterable of (, ); received idofOne (a str).
and have tried to convert to int() but then get a different error saying :
ValueError: invalid literal for int() with base 10: ''
What is going on? I'm using Google App Engine - and retrieving the idofOne from the html template. It is the ID representation using jinja -- and it is showing a value of "1" - so it shouldn't be empty - any suggestions???
class makeHeadings3(Handler):
def get(self):
self.render('new_entries/ADMIN_make_headings3.html')
def post(self):
idofOne = self.request.get("idofOne")
type2=self.request.get("type2")
heading2name = self.request.get("headingTwo")
description2 = self.request.get("descriptionTwo")
heading3 = self.request.get("headingThree")
#getting relevant level 1 entry by id
level_1_info=Level_1_Headings.get_by_id(idofOne)
Actually - I changed the value coming from my template from the id() to the key(). However I'm discovering that in my template from which I'm retrieving the value from is coming back empty string "". why? I see the value of the key in teh template and I'm retrieving with the correct name "keyofOne" so why is it coming back empty back to my python server code???
Key for Category Level 1
DO NOT EDIT
You could first check:
level_1_info=Level_1_Headings.get_by_id("1")
Then need to add debug in your code to see what value is returned by "idofOne"
import logging
# snip
logging.info("type "+type(idofOne))
logging.info("value "+idofOne)
I hope this helps
The below should fix it. You need to get the integer value of that id
idofOne = int(self.request.get("idofOne"))
Always when parsing post or get parameters you have to convert them to the correct type before passing them to the datastore query.