SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2007
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Json parse error on <p>

    Hello

    I am unable to to edit a json file i need to add some updates but i keep getting

    Code:
    Error: Parse error on line 8:
    ...           "text" : "
    
       company name -----------------------^ Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'undefined'
    I am trying to add a paragraph with a section and when i put a <p> i get the error

    here is the code, please can you assist?

    Code:
    {
         "subSections":
         [
             {
               "title" : "The main website",
               "url" : "main-website",
               "linktitle" : "The main website",
               "text" : "<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>"
             }, {
               "title" : "The main reception",
               "url" : "main-reception",
               "linktitle" : "The main reception",
               "text" : "<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>"
             }, {
               "title" : "A heading",
               "url" : "a url heading",
               "linktitle" : "A heading",
               "text" : "<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p><p>Our role involves ensuring that there is a warm friendly service for our patients and families when they come to GOSH.</p><p> Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.</p><p> It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>"
             }, {
               "title" : "A heading",
               "url" : "a url heading",
               "linktitle" : "A heading",
               "text" : "<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p><p>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.</p>"
             }, {
               "title" : "A heading",
               "url" : "a url heading",
               "linktitle" : "A heading",
               "text" : "<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>"      
             }, {
               "title" : "A heading",
               "url" : "a url heading",
               "linktitle" : "A heading",
               "text" : "<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>"
             }, {
               "title" : "A heading",
               "url" : "a url heading",
               "linktitle" : "A heading",
               "text" : "<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, </p>"
             }
         ]
     }

  2. #2
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,191
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    What is the JavaScript code you're using to parse this JSON?

  3. #3
    SitePoint Enthusiast
    Join Date
    Apr 2007
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think it is modernizr-2.0.6.min

  4. #4
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,191
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Modernizr doesn't parse JSON, I'm referring to the code you have designed to handle the JSON for your website.

  5. #5
    SitePoint Enthusiast
    Join Date
    Apr 2007
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    HTML

  6. #6
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,819
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by jelly46 View Post
    HTML
    Your response makes no sense. JSON in the web page gets parsed either with the JavaScript JSON.parse() command or with an equivalent provided either by a JavaScript library or bvia your own code. HTML has nothing whatever to do with JSON.

    Also with the JSON you poted there is no reason why that code would give a parse error.

    The only reason I can think of for it giving a parse error is if you are trying to parse it as HTML instead of parsing it as JSON.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •