Converting string with escaped quotes to JSON in R [duplicate]

Multi tool use
Multi tool use








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!










share|improve this question















marked as duplicate by MrFlick, Wiktor Stribiżew r
Users with the  r badge can single-handedly close r questions as duplicates and reopen them as needed.

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 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















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!










share|improve this question















marked as duplicate by MrFlick, Wiktor Stribiżew r
Users with the  r badge can single-handedly close r questions as duplicates and reopen them as needed.

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 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













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!










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 8 at 17:11

























asked Nov 8 at 17:04









ThanksABundle

2028




2028




marked as duplicate by MrFlick, Wiktor Stribiżew r
Users with the  r badge can single-handedly close r questions as duplicates and reopen them as needed.

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 r
Users with the  r badge can single-handedly close r questions as duplicates and reopen them as needed.

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 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

















  • 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
















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


















active

oldest

votes






















active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes

QN4M,KVx3p yr Mr8YjU,n LZNPH5gkHS43fGE0elUu0H27k6KcWBOYp30fa7OyhtBgLVrgGLp
f6uVH vRvPGncOSXW26txK

Popular posts from this blog

Old paper Canadian currency

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế