html.raw in jquery?

Following on from this question's-in-wrong-order.html?headerLink=workspace_answered_questions

I now need to
call the following

                type: "POST",
                url: "@Url.Action("CameraChange", "Home")",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (response) {
                   imageDataArray = response.DataArray;

Open in new window

However I've no idea how to convert to returned string
[[273.7,273.8,273.8,274.6,274.6,274,274,274.3,274........ ]]

Open in new window

to the JS object: imageDataArray

In the othe question i used @HTML.RAW, which works great and i can then access the data like

Open in new window

to get the value at that position

How would i do this in Js/Jquery?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
Excatly the same way.

The returned data is an array of arrays.

Open in new window

Will give you the first value in the first array
websssCEOAuthor Commented:
I puit an alert on that code, Sometimes it seems to work, other times it just returns [

But either way, its not updating the object correctly, it doesn't seem to be an array or work with the rest of the code

this is what i see from HTML RAW, and it works fine (from initial question, this works great now)
However after updating the object, it looks like this, and it doesn't work with the rest of the code
Julian HansenCommented:
It might be that it needs to be parse again - not sure why it would as you have specified dataType: json in your AJAX options.

Just for giggles try this

imageArray = JSON.parse(response.DataArray);

Open in new window

And then see what that gives you.

Failing that can you post a text file or similar with the results of the AJAX response.

You can get it like this

<textarea id="result"></textarea>

Open in new window

And in your AJAX Callback
$('#result').value = response.DataArray;

Open in new window

Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

Kelvin McDanielSr. DeveloperCommented:
Please post the HomeController/CameraChange method so we can see what it returns?
websssCEOAuthor Commented:
This is the code
        public JsonResult CameraChange(string cameraId)

            camera = process.GetCamByCamId(cameraId);

            var imageData = process.Process_Image_Temp_Files_OnLoad(camera).FirstOrDefault();

            return Json(imageData, JsonRequestBehavior.AllowGet);

Open in new window

the bit in question is in another method and saves this as a string
pd.DataArray = JsonConvert.SerializeObject(temperatureData);
Julian HansenCommented:
The code that generates it is not really in play on this one - if anything we need to see the raw response.

Did you try the JSON.parse()?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
websssCEOAuthor Commented:
Thanks, JSON.parse() fixed it
Julian HansenCommented:
You are welcome.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.