Hello,

Yes, I did escape all of them but got the same error.

I have tried Christian's solution which solves the problem, and good to know
about ' too.

Many thanks,
Thomas

-----Original Message-----
From: basex-talk-boun...@mailman.uni-konstanz.de
[mailto:basex-talk-boun...@mailman.uni-konstanz.de] On Behalf Of Sebastian
Albert
Sent: 10 August 2017 13:47
To: basex-talk@mailman.uni-konstanz.de
Subject: Re: [basex-talk] Single quotes with json::parse

Just to make sure: Have you also escaped Merchant Taylors' School at the
same time?

I've successfully tried ' to escape the apostrophe.

On 10.08.2017 14:41, Thomas Daly wrote:
> Regarding the JSON module json::parse function, how do you cope with 
> single quotes within the JSON data?
> 
>  
> 
> I have tried escaping them with a backslash, but to no avail.  In this 
> example I think it's the single quote in "St. John's College" that is 
> causing the problem:
> 
>  
> 
> XQUERY let $database := 'lk'
> 
>                         let $options := map { 'format': 'direct',
> 'escape': 'yes' }
> 
>                         let $j :=
> json:parse('{"roles":["poet","cleric"],"institutions":["St John's 
> College","Cambridge 
> University"],"characterId":"595051204300","homes":["Cheapside","London
> ","Dean 
> Prior","Devon"],"image":"robert_herrick.jpg","DOB":"1591-08-24","attri
> butes":["People educated at Merchant Taylors' 
> School","Northwood","Alumni of St John's College","Cambridge","Alumni 
> of Trinity Hall","Cambridge","English poets","People from the City of 
> London","People educated at Westminster School","London","English male 
> poets"],"DOD":"1674-10-08","nationality":"British","givenName":"Robert
> ","familyName":"Herrick"}',
> $options)
> 
>                         return db:add($database, $j,
> 'characters/c_595051204300_Robert_Herrick.xml')
> 
>  
> 
> Stopped at ., 3/78:
> 
> [XPST0003] Expecting closing bracket: json:parse. at 
> /usr/local/lib/basex-api/src/main/perl/BaseXClient.pm line 58.
> 
>  
> 
> Many thanks,
> 
> Thomas
> 
>  
> 


Reply via email to