Dear all 
    There are a stardand  JSON format file from R code. It have a error on
this file. 
    How to modify this source code for a stardand  JSON format file? 
    Test1: 
    Soure code for R studio: 
            Issue_Name<-c("Tag over 30% in minutes") 
            URL_Link<-c("http://61.221.174.234/trendalarm_all.txt";) 
            ULink=list(Issue=Issue_Name,URL=URL_Link) 
            #ULink to JSON format 
            sink("ULink.txt") 
            cat(toJSON(ULink)) 
            sink() 
    Result:<This is not a stardand  JSON format file>
            > cat(toJSON(ULink)) 
           {"Issue":"Tag over 30% in
minutes","URL":"http://61.221.174.234/trendalarm_all.txt"} 
            > sink() 
    Test2: 
    Soure code for R studio: 
            Issue_Name<-c("Tag over 30% in minutes") 
            URL_Link<-c("http://61.221.174.234/trendalarm_all.txt";) 
            ULink=list(Issue=Issue_Name,URL=URL_Link) 
            
    Run R source code, then run the below command on console windows  
            sink("ULink.txt") 
            cat(toJSON(ULink)) 
            sink() 
    Result:<This is a stardand JSON format file>
           {"Issue":"Tag over 30% in
minutes","URL":"http://61.221.174.234/trendalarm_all.txt"} 
Thanks



--
View this message in context: 
http://r.789695.n4.nabble.com/R-write-to-JSON-format-error-tp4706860.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to