Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: lexical error: invalid character inside string #8

Open
oriolcosp opened this issue Dec 11, 2019 · 2 comments
Open

Error: lexical error: invalid character inside string #8

oriolcosp opened this issue Dec 11, 2019 · 2 comments

Comments

@oriolcosp
Copy link

oriolcosp commented Dec 11, 2019

Hi,
When running:

tmp = mixpanelGetEvents(account, from = date, to = date, daysPerBlock = 10,
                          select = vars, verbose = TRUE, df = TRUE, encoding="UTF-8")

I was getting the error:

Error: lexical error: invalid character inside string.
          amsung","$carrier":"DAIS-Virgi ",
                    (right here) ------^

Apparently, Mixpanel was putting some invalid json character on the data we were getting and that was causing the error.

I managed to fix it by going into the function eventsJson2RMatrix and adding at the start:

jsonData = gsub('\x06','',jsonData)

I hope this helps improve the package. Thanks!

@christerwi
Copy link

Hi,
we have the same issue sometimes – note that it is not an error on the mixpanel side: they are sending you the data as it was ingested from the SDK (the carrier has a funky name...)
The core problem is that the used package jsonlite has become very strict about throwing errors when the json is improper since package version 0.9.12 –– so if it is feasible for you, you can install the specific previous version (0.9.11) just for getting the data you need. Other than that, it might go better with jsonlite::streamin, since mixpanel sends line-complete json...
reference: jeroen/jsonlite#59

@dlazarou
Copy link

dlazarou commented Feb 3, 2021

the solution from @oriolcosp doesn't work anymore unfortunately.
Any other idea to circumvent the issue? Using R 4.0 and the most updated package of Rmixpanel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants