Yes, the quotes need to be escaped - since they are contained within a quoted string, which you didn't show. That is the proper convention for representing strings in JSON. Are you familiar with the JSON format? If not, try XML - it won't have to represent a string as a quoted JSON string.

If you read and parse the Solr response with a JSON parser, you should get your original JSON string value back intact. Now, you may want to do a JSON parse of that string itself, but that has nothing to do with the Solr JSON response itself. As you said, you wanted to store and retrieve JSON as a string field, which Solr appears to be doing correctly.

-- Jack Krupansky

-----Original Message----- From: Karthick Duraisamy Soundararaj
Sent: Wednesday, May 22, 2013 8:03 PM
To: solr-user@lucene.apache.org
Subject: Storing and retrieving json

Hello all,
               I am facing a need to store and retrieve json string in a
field.

eg.  Imagine a schema like below.
[Please note that this is just an example but not actual specification.]

<str name="carName" type="string" indexed="true" stored="false">
<str name="carDescription" type="string" indexed="false" stored="false">

carDescription is a json string . An example would be
  { "model":1988 "type":"manual"}

I dont need to search on the carDescription. I want to store some json data
and retreive. When i feed json data to carDescription field through DIH,
the response for the query is like below

  {\ "model\":1988 \"type\":\"manual\"}

All the quotes are escaped. I dont want this. I want the original
unmodified data. Is there a way to do this?

Thanks,
Karthick

Reply via email to