Richtext editor is very likely to add markup that will break JSON.
I'd suggest you switch back to textarea.
I did the reverting back to textarea as you suggested.
My <cms:template> block is defined as:
- Code: Select all
<cms:template title="TO DO" clonable='1' routable='1' >
<cms:editable type='uid' name='todo_uid' search_type='integer' order='1' />
<cms:editable name='to_do_desc' label="To Do Description" type="textarea" no_xss_check='1' order='2' />
<!-- Routes -->
<cms:route name='list_todo' path='' />
<cms:route name='create_todo' path='create' />
<cms:route name='edit_todo' path='{:id}/edit' >
<cms:route_validators id='non_zero_integer' />
</cms:route>
<cms:route name='view_todo' path='{:id}' />
<cms:route name='delete_todo' path='{:id}/delete' >
<cms:route_validators id='non_zero_integer' />
</cms:route>
<!-- Routes -->
</cms:template>
My JOSN is defined as:
- Code: Select all
<?php require_once( '../couch/cms.php' ); ?>
<cms:template title='TO DO JSON' order='105' icon='home' hidden='1 '/>
<cms:content_type 'application/json'/>
{
"todo":
[
<cms:pages masterpage='to-do.php' show_future_entries='1'>
{
"todotitle":"<cms:show k_page_title />",
"tododesc":"<cms:nl2br><cms:show to_do_desc /></cms:nl2br>"
}
<cms:if "<cms:not k_paginated_bottom />">, </cms:if>
</cms:pages>
]
}
<?php COUCH::invoke(); ?>
The output JSON is:
{
"todo":
[
{
"todotitle":"Fire Fighting:",
"tododesc":"<p><strong>1. <u>Dry chemical powder type fire extinguisher (DCP)</u>:</strong></p><br />
<br />
<p> These types are suitable for tackling petroleum, gas, electrical fire and controlling fires of textile fibres. Sodium based chemical powder is used on a fire which undergo chemical reaction.</p><br />
<br />
<p><strong>2. <u>How to Use</u>:</strong></p><br />
<br />
<p>(i) Carry to the place of fire and keep it up right.</p><br />
<br />
<p>(ii) Remove the safety clip. Hold the nozzle pipe tightly.</p><br />
<br />
<p>(iii) Strike the knob located in the cap.</p><br />
<br />
<p>(iv) Sealing disk of the cartridge gets broken and allows carbon dioxide gas to escape to the main shell and powder is pushed out.</p><br />
<br />
<p>(v) Direct the steam of the powder at the base of the flame.</p><br />
<br />
<p>(vi) For effective result stand at about 1.5 to 2.5 metre near the seat of the fire.</p><br />
<br />
<p>(vii) Move forward with moving the nozzle rapidly from side to side in sweeping motion.</p><br />
<br />
<p>(viii) When using on outdoor fires operate from the up wind side for effective spray.</p><br />
<br />
<p>3. <u>Building Evacuation</u>:</p><br />
<br />
<p> When the building fire alarm sounds:</p><br />
<br />
<p>(i) Immediately evacuate using building emergency plan procedures.</p><br />
<br />
<p>(ii) Walk to nearest exit/stairwell (close doors behind you)</p><br />
<br />
<p>(iii) Don’t use elevators.</p><br />
<br />
<p>(iv) Proceed to the designated gathering area outside the building.</p><br />
<br />
<p>(v) Do not re-enter building until cleared by authorised personnel.</p><br />
<br />
<p>(vi) Assist in evacuation of individuals with special needs.</p><br />
<br />
<p> </p><br />
<br />
<p><strong>4. <u>Suspicious substance in Railway premises</u>:</strong></p><br />
<br />
<p>(i) Clear and isolate the contaminated area. Do not touch or disturb anything.</p><br />
<br />
<p>(ii) Call police/fire service/bomb squad.</p><br />
<br />
<p>(iii) Wash your hands with soap and water.</p><br />
<br />
<p>(iv) Identify individuals who may have been exposed to the material.</p><br />
<br />
<p> (v) Do not leave premises until disposed off by authorised personnel.</p><br />
<br />
<p> </p><br />
<br />
<p> <strong> 5. <u>Bomb threat/Blast</u>:</strong></p><br />
<br />
<p>Person receiving call regarding bomb threat should:</p><br />
<br />
<p>(i) Attempt to gain as much information as possible from the caller like type of device, time set, location, reason/purpose of the act, dialect mannerism and identity of the caller.</p><br />
<br />
<p>(ii) Inform and alert the disaster management team (Bomb detection squad)</p><br />
<br />
<p>(iii) Alert police, fire brigade and explosive department.</p><br />
<br />
<p>(iv) Pass on the information to all departments concerned.</p><br />
<br />
<p>(v) Take initiative for evacuation of all persons from premises.</p><br />
<br />
<p>(vi) Persons noticing a bomb like object, should bring it to the notice of the nearest available officer.</p><br />
<br />
<p>(vii) Inform GRP, RPF, and bomb detection squad.</p><br />
<br />
<p>(viii) Ensure all persons are away from the spot and avoid unnecessary crowding near the area.</p><br />
<br />
<p>(ix) Inform Control to take further steps for regulating train services.</p><br />
<br />
<p>(x) Wait for clearance from the police department to restore normal working.</p><br />
<br />
<p>(xi) Utilise “Caller ID” facility, if provided, to trace the caller.</p><br />
<br />
<p> </p><br />
<br />
<p><strong>6. <u>Radiation Emergency</u>:</strong></p><br />
<br />
<p>(a) Personal injury involving radioactive material contamination:</p><br />
<br />
<p> (i) Render first aid immediately for serious injuries, as trained.</p><br />
<br />
<p> (ii) Call bomb squad, fire station.</p><br />
<br />
<p> (iii) If possible, without causing harm to the victim, monitor the injured; remove contaminated clothing and reduce personal contamination.</p><br />
<br />
<p>(b) Radioactive contamination of personnel:</p><br />
<br />
<p>(i) Remove and bag all contaminated clothing.</p><br />
<br />
<p>(ii) Call fire station, bomb squad, and police.</p><br />
<br />
<p>(iii) Skin contamination should be cleaned using mild soap and tepid water. Use portable survey meter to monitor for remaining contamination. If not free of contamination, re-wash and re-survey.</p><br />
<br />
<p> </p><br />
<br />
<p><strong>7. <u>What to do upon receipt of suspicious letter/package</u>:</strong></p><br />
<br />
<p>(i) Handle with care.</p><br />
<br />
<p>(ii) Don’t shake or bump.</p><br />
<br />
<p>(iii) Isolate and look for indicators.</p><br />
<br />
<p>(iv) Don’t open, smell or taste.</p><br />
<br />
<p>(v) Treat it as suspect.</p><br />
<br />
<p>(vi) Call Police/Fire service/Bomb squad.</p><br />
<br />
<p> </p><br />
<br />
<p><strong>8. <u>If parcel is Open and/or Threat is identified</u>:</strong></p><br />
<br />
<p>(a) <u>For a bomb</u>:</p><br />
<br />
<p> (i) Evacuate immediately,</p><br />
<br />
<p> (ii) Call Police/ Fire service/Bomb squad.</p><br />
<br />
<p>(b) <u>For Radiological</u>:</p><br />
<br />
<p> (i) Limit exposure- don’t handle,</p><br />
<br />
<p> (ii) Evacuate area,</p><br />
<br />
<p> (iii) Shield yourself from the object.</p><br />
<br />
<p> (iv) Call Police/ Fire service/Bomb squad.</p><br />
<br />
<p>(c) <u>For Biological or Chemical</u>:</p><br />
<br />
<p> (i) Isolate – don’t handle,</p><br />
<br />
<p> (ii) Call Police/ Fire service/Bomb squad.</p><br />
<br />
<p> (iii) Wash your hands with soap and water.</p>"
}
, {
"todotitle":"Test 2",
"tododesc":"TEst For Uid"
}
, {
"todotitle":"Disaster To Do Resource Material",
"tododesc":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin laoreet, dui quis pulvinar dapibus, elit lectus pellentesque mauris, id lacinia felis mi non velit. Nunc eu lobortis orci. Morbi at fringilla metus. Duis molestie, eros a vulputate pharetra, nulla diam bibendum urna, non gravida arcu magna ac eros. Vestibulum scelerisque tortor magna, et faucibus odio feugiat non. Vestibulum eu ligula ac elit aliquam posuere et vitae mauris. Donec aliquet finibus odio, vel viverra sem mollis ac.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin laoreet, dui quis pulvinar dapibus, elit lectus pellentesque mauris, id lacinia felis mi non velit. Nunc eu lobortis orci. Morbi at fringilla metus. Duis molestie, eros a vulputate pharetra, nulla diam bibendum urna, non gravida arcu magna ac eros. Vestibulum scelerisque tortor magna, et faucibus odio feugiat non. Vestibulum eu ligula ac elit aliquam posuere et vitae mauris. Donec aliquet finibus odio, vel viverra sem mollis ac. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin laoreet, dui quis pulvinar dapibus, elit lectus pellentesque mauris, id lacinia felis mi non velit. Nunc eu lobortis orci. Morbi at fringilla metus. Duis molestie, eros a vulputate pharetra, nulla diam bibendum urna, non gravida arcu magna ac eros. Vestibulum scelerisque tortor magna, et faucibus odio feugiat non. Vestibulum eu ligula ac elit aliquam posuere et vitae mauris. Donec aliquet finibus odio, vel viverra sem mollis ac."
}
]
}
JSON Error is:
SyntaxError: JSON.parse: bad control character in string literal at line 6 column 141 of the JSON data
jsonlint.com error is:
Error: Parse error on line 11:
...", "tododesc": "<p><strong>1.
Its a lot of text and points. This is required to supply to a mobile.
Regards,
GenXCoders (Priya)