Converting string with escaped quotes to JSON in R [duplicate]
up vote
-2
down vote
favorite
This question already has an answer here:
Remove backslashes from character string
2 answers
How to replace a string with a single backslash using gsub in R?
3 answers
I have a string that looks like this:
["playerId":104,"participantId":"1509032316400100006","startHole":0,"thru":0,"roundScores":["round":1,"strokes":75],"roundHoleScores":]
It's almost in JSON format except that the quotes are escaped. I want to use jsonlite::fromJSON() on it but it won't work because of the escaped quotes.
Does anybody know how I can treat that string as JSON?
Thanks!
r json regex
marked as duplicate by MrFlick, Wiktor Stribiżew
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Nov 8 at 21:01
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
up vote
-2
down vote
favorite
This question already has an answer here:
Remove backslashes from character string
2 answers
How to replace a string with a single backslash using gsub in R?
3 answers
I have a string that looks like this:
["playerId":104,"participantId":"1509032316400100006","startHole":0,"thru":0,"roundScores":["round":1,"strokes":75],"roundHoleScores":]
It's almost in JSON format except that the quotes are escaped. I want to use jsonlite::fromJSON() on it but it won't work because of the escaped quotes.
Does anybody know how I can treat that string as JSON?
Thanks!
r json regex
marked as duplicate by MrFlick, Wiktor Stribiżew
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Nov 8 at 21:01
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
can youdput()
the character vector that has the string in it?
– hrbrmstr
Nov 8 at 17:06
With mystring %>% dput() %>% fromJSON() ? I get the same error doing that.
– ThanksABundle
Nov 8 at 17:08
no, paste the output ofdput()
of the character vector into the question in a code block.
– hrbrmstr
Nov 8 at 17:10
Are you sure the quotes are escaped in the string? R adds escapes when itprint()
s the value of a character variable to the terminal but those escapes aren't really in the string. Is that you've show what R shows you, or is this some raw text file you are looking at? It's easier to help if you provide a proper reproducible example with code and data we can copy/paste into R to see exactly what you're working with. If they are escaped in the raw data, how exactly did it get that way to begin with?
– MrFlick
Nov 8 at 17:10
add a comment |
up vote
-2
down vote
favorite
up vote
-2
down vote
favorite
This question already has an answer here:
Remove backslashes from character string
2 answers
How to replace a string with a single backslash using gsub in R?
3 answers
I have a string that looks like this:
["playerId":104,"participantId":"1509032316400100006","startHole":0,"thru":0,"roundScores":["round":1,"strokes":75],"roundHoleScores":]
It's almost in JSON format except that the quotes are escaped. I want to use jsonlite::fromJSON() on it but it won't work because of the escaped quotes.
Does anybody know how I can treat that string as JSON?
Thanks!
r json regex
This question already has an answer here:
Remove backslashes from character string
2 answers
How to replace a string with a single backslash using gsub in R?
3 answers
I have a string that looks like this:
["playerId":104,"participantId":"1509032316400100006","startHole":0,"thru":0,"roundScores":["round":1,"strokes":75],"roundHoleScores":]
It's almost in JSON format except that the quotes are escaped. I want to use jsonlite::fromJSON() on it but it won't work because of the escaped quotes.
Does anybody know how I can treat that string as JSON?
Thanks!
This question already has an answer here:
Remove backslashes from character string
2 answers
How to replace a string with a single backslash using gsub in R?
3 answers
r json regex
r json regex
edited Nov 8 at 17:11
asked Nov 8 at 17:04
ThanksABundle
2028
2028
marked as duplicate by MrFlick, Wiktor Stribiżew
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Nov 8 at 21:01
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by MrFlick, Wiktor Stribiżew
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Nov 8 at 21:01
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
can youdput()
the character vector that has the string in it?
– hrbrmstr
Nov 8 at 17:06
With mystring %>% dput() %>% fromJSON() ? I get the same error doing that.
– ThanksABundle
Nov 8 at 17:08
no, paste the output ofdput()
of the character vector into the question in a code block.
– hrbrmstr
Nov 8 at 17:10
Are you sure the quotes are escaped in the string? R adds escapes when itprint()
s the value of a character variable to the terminal but those escapes aren't really in the string. Is that you've show what R shows you, or is this some raw text file you are looking at? It's easier to help if you provide a proper reproducible example with code and data we can copy/paste into R to see exactly what you're working with. If they are escaped in the raw data, how exactly did it get that way to begin with?
– MrFlick
Nov 8 at 17:10
add a comment |
can youdput()
the character vector that has the string in it?
– hrbrmstr
Nov 8 at 17:06
With mystring %>% dput() %>% fromJSON() ? I get the same error doing that.
– ThanksABundle
Nov 8 at 17:08
no, paste the output ofdput()
of the character vector into the question in a code block.
– hrbrmstr
Nov 8 at 17:10
Are you sure the quotes are escaped in the string? R adds escapes when itprint()
s the value of a character variable to the terminal but those escapes aren't really in the string. Is that you've show what R shows you, or is this some raw text file you are looking at? It's easier to help if you provide a proper reproducible example with code and data we can copy/paste into R to see exactly what you're working with. If they are escaped in the raw data, how exactly did it get that way to begin with?
– MrFlick
Nov 8 at 17:10
can you
dput()
the character vector that has the string in it?– hrbrmstr
Nov 8 at 17:06
can you
dput()
the character vector that has the string in it?– hrbrmstr
Nov 8 at 17:06
With mystring %>% dput() %>% fromJSON() ? I get the same error doing that.
– ThanksABundle
Nov 8 at 17:08
With mystring %>% dput() %>% fromJSON() ? I get the same error doing that.
– ThanksABundle
Nov 8 at 17:08
no, paste the output of
dput()
of the character vector into the question in a code block.– hrbrmstr
Nov 8 at 17:10
no, paste the output of
dput()
of the character vector into the question in a code block.– hrbrmstr
Nov 8 at 17:10
Are you sure the quotes are escaped in the string? R adds escapes when it
print()
s the value of a character variable to the terminal but those escapes aren't really in the string. Is that you've show what R shows you, or is this some raw text file you are looking at? It's easier to help if you provide a proper reproducible example with code and data we can copy/paste into R to see exactly what you're working with. If they are escaped in the raw data, how exactly did it get that way to begin with?– MrFlick
Nov 8 at 17:10
Are you sure the quotes are escaped in the string? R adds escapes when it
print()
s the value of a character variable to the terminal but those escapes aren't really in the string. Is that you've show what R shows you, or is this some raw text file you are looking at? It's easier to help if you provide a proper reproducible example with code and data we can copy/paste into R to see exactly what you're working with. If they are escaped in the raw data, how exactly did it get that way to begin with?– MrFlick
Nov 8 at 17:10
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
can you
dput()
the character vector that has the string in it?– hrbrmstr
Nov 8 at 17:06
With mystring %>% dput() %>% fromJSON() ? I get the same error doing that.
– ThanksABundle
Nov 8 at 17:08
no, paste the output of
dput()
of the character vector into the question in a code block.– hrbrmstr
Nov 8 at 17:10
Are you sure the quotes are escaped in the string? R adds escapes when it
print()
s the value of a character variable to the terminal but those escapes aren't really in the string. Is that you've show what R shows you, or is this some raw text file you are looking at? It's easier to help if you provide a proper reproducible example with code and data we can copy/paste into R to see exactly what you're working with. If they are escaped in the raw data, how exactly did it get that way to begin with?– MrFlick
Nov 8 at 17:10