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

  • SEARCH
  • Home
  • 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 9248339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:55:25+00:00 2026-06-18T09:55:25+00:00

I have a serialized string comming from the controller to a view: Controller: var

  • 0

I have a serialized string comming from the controller to a view:

Controller:

var serialize = new JavaScriptSerializer();
return Json(new
{
data = serialize.Serialize(obj)
}, JsonRequestBehavior.AllowGet);

Json string:

[{"indiceName":"Caracter","indiciId":24,"indiceId":1,"tamanhoIndice":10,"mask":null,"indiceObr":1},

{"indiceName":"Numérico","indiciId":25,"indiceId":2,"tamanhoIndice":10,"mask":null,"indiceObr":0},

{"indiceName":"AlfaNumérico","indiciId":26,"indiceId":3,"tamanhoIndice":10,"mask":null,"indiceObr":0}]

As far as I know, modern browser should be able to parse that string with a simple
Json.parse()

View:

success: function (data) 
         {
            $('.dinamic').remove();
            console.log(data);
            var obj2 = JSON.parse(data);
            console.log(obj2);
         }

I am able to see that string in the first console.log, but I get nothing from the second.
Is there any thing else I should be looking at because all the post I have read people only do it as simple as it is with a single JSON.parse.
I am using latest version of google chrome ,firefox and IE so it should work.

  • 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-18T09:55:26+00:00Added an answer on June 18, 2026 at 9:55 am

    Although your success function is not shown in context of the other AJAX options being given, I would guess you are passing a dataType option of “json”, or are using $.getJSON or something similar.

    If that is the case, jQuery has already parsed the JSON for you by the time it passes it into success so you do not need to (and cannot) parse it again. You can simply use your data structure (data[0]. indiceName and etc).

    (The below code is running live at http://jaaulde.com/test_bed/GuilhermeLongo/ )

    Consider the following PHP (stored in json.php):

    <?php
    exit('[{"indiceName":"Caracter","indiciId":24,"indiceId":1,"tamanhoIndice":10,"mask":null,"indiceObr":1},{"indiceName":"Numérico","indiciId":25,"indiceId":2,"tamanhoIndice":10,"mask":null,"indiceObr":0},{"indiceName":"AlfaNumérico","indiciId":26,"indiceId":3,"tamanhoIndice":10,"mask":null,"indiceObr":0}]');
    

    And the following JS:

    <script src="http://code.jquery.com/jquery.min.js"></script>
    <script>
      $.ajax({
        url: 'json.php',
        type: 'get',
        dataType: 'json',
        success: function (data) {
          console.log(data[0]);
          console.log(data[0].indiceName);
        },
        error: function () {
          throw new Error('AJAX request error occurred.');
        }
      });
    </script>
    

    It results in the following outputted log info:

    GET http://jaaulde.com/test_bed/GuilhermeLongo/json.php
        200 OK
        99ms    
        jquery.min.js (line 3)
    
    Object
        {indiceName="Caracter", indiciId=24, indiceId=1, more...}/test_...eLongo/
        (line 8)
    
    Caracter
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a method that retrieves data from a json serialized string and writes
I have the following serialized data string (Some of the contents are from checkboxes
I have a serialized string comming in with POST: $imgdata = $_POST['imgdata']; // li[]=2&li[]=3&li[]=1&li[]=4
I have a serialized json string in the format: [{\Version\:\8.63\,\Date\:\07\/11\/2011 00:00:00\,\Count\:213}, {\Version\:\1.0\,\Date\:\07\/11\/2011 00:00:00\,\Count\:1}, .........
I have a serialized JSON String (chef role definition actually) and it has a
I have serialized a string in PHP using serialize method $serializedResult = serialize($value); How
I have a JSON string as : var jsonString = JSON.stringify(dataObject); document.getElementById(hdnChromedata).value = jsonString;
I'm using DataContracts to serialize objects. Suppose I have serialized a data structured in
i have the following code: public static void Serialize() { List<string> dirs = FileHelper.GetFilesRecursive(fileDirectoryPath);
So, I have serialized data within the uc_orders table. This data has several parameters

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.