Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8745057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:56:39+00:00 2026-06-13T11:56:39+00:00

I have a hidden input field like <input type=hidden name=product-data value={Product: ‘Premium’, Code: ‘ER412’,

  • 0

I have a hidden input field like

<input type="hidden" name="product-data" value="{Product: 'Premium', Code: 'ER412', SalesCode: 'SC415', Description: 'Premium Product Details'}" />

on click of a button I am trying to convert this value into JSON object but getting error. Here is my js code

$('.icon-edit').live('click', function(){

        var data = $(this).parent().siblings('input').val();
        data = jQuery.parseJSON(data); // <--- Here I am getting error
        //do something with data

    });

Error:

SyntaxError: JSON.parse: expected property name or '}'
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:56:39+00:00Added an answer on June 13, 2026 at 11:56 am

    JSON property names are strings, and JSON strings are delimited by " characters.

    Your property names are identifiers, and where you have string values, you have delimited them with '. This is fine for a JavaScript object literal, but not for JSON.

    <input 
        type="hidden" 
        name="product-data" 
        value="{&quot;Product&quot;: &quot;Premium&quot;, &quot;Code&quot;: &quot;ER412&quot;, &quot;SalesCode&quot;: &quot;SC415&quot;, &quot;Description&quot;: &quot;Premium Product Details&quot;}" 
    />
    

    (You could also delimit the HTML attribute value with ' and use literal "s inside it)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an hidden input field with a value, <form> <input type=hidden value=product/> <select
I have the below code in my .aspx page. <input type=hidden id=fbinfo name=fbinfo value=
I have a field on my page, like this: <input type=hidden name=myField id=myField />
I have a hidden input field on a page <div id=SomeDiv> <input type=text name=ID
I have a HTML hidden field: <input type=hidden title=aaa value=bbb id=TAB runat=server /> I
I have some hidden inputs like this <input name=exam.normals[1].blahblah ..../> I would like somehow
I have this <%=Model.StartDate%> <%=Html.Hidden(StartDate, Model.StartDate)%> it outputs: 2010-05-11 11:00:00 +01:00 <input type=hidden value=2010-03-17
I have a hidden input field in my form. I noticed that if that
I have been trying to set the value of a hidden input by using
I have stored data in hidden <input> tags, but it caused reduction in performance.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.