commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emmanuel Bourg (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CSV-116) Support JSON-encoded properties such as GeoJSON
Date Tue, 10 Jun 2014 09:43:01 GMT

    [ https://issues.apache.org/jira/browse/CSV-116?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14026275#comment-14026275
] 

Emmanuel Bourg commented on CSV-116:
------------------------------------

I haven't tested but I believe we already support these escaping schemes.

*case 1*

{code}"{\"type\":\"Point\",\"coordinates\":[30.0,10.0]}" // escaped{code}

This is the usual escaping case, it should work with this format:

{code}CSVFormat.DEFAULT.withQuoteChar('"').withEscape('\\'){code}

*case 2*

{code}'{"type":"Point","coordinates":[30.0,10.0]}' // single quotes no need for escaped{code}

There is no escaping here, this can be done with:

{code}CSVFormat.DEFAULT.withQuoteChar('\''){code}

*case 3*

{code}"{""type"":""Point"",""coordinates"":[30.0,10.0]}" // filebakery.com style{code}

Here the quote character is escaped by doubling it, this could be done with the following
format but I'm not sure it works:

{code}CSVFormat.DEFAULT.withQuoteChar('"').withEscape('"'){code}



> Support JSON-encoded properties such as GeoJSON
> -----------------------------------------------
>
>                 Key: CSV-116
>                 URL: https://issues.apache.org/jira/browse/CSV-116
>             Project: Commons CSV
>          Issue Type: Improvement
>          Components: Parser
>            Reporter: Ron Gavlin
>             Fix For: Discussion
>
>
> Support the three json row quoting flavors currently supported by the mapnik.org csv
plugin described here: https://github.com/mapnik/mapnik/issues/1392.
> The proposed supported flavors are:
> {noformat}
>     "{\"type\":\"Point\",\"coordinates\":[30.0,10.0]}" // escaped
>     '{"type":"Point","coordinates":[30.0,10.0]}' // single quotes no need for escaped
>     "{""type"":""Point"",""coordinates"":[30.0,10.0]}" // filebakery.com style
> {noformat}
> Note the following commit for this mapnik feature has sample CSV files for your reference:
https://github.com/mapnik/mapnik/commit/f42805a5321d42f59b447a70f459058cf2c6cd5c



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message