.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

JSON.parse error

Posted By:      Posted Date: August 31, 2010    Points: 0   Category :ASP.Net
Hi all, I am fairly new to asp.net and am just learning JSON.  I am trying to display a JSON result in a partial view, but I am getting the JSON.parse error.  I know I am getting the JSON response back - I can see it in Firebug and it must be in the correct format as I am getting the JSON tab and the data looks correct.  I am not sure what I am doing wrong.  Any help is very much appreciated. Thanks in advance, Donna Here's my code: The partial view:<%@ Control Language="VB" Inherits="System.Web.Mvc.ViewUserControl(Of IEnumerable (Of gmcps.StateItem))" %> <script type="text/javascript"> function getSalesRepInfo(e) { alert("state chosen is " + e.value); $.ajax({ type: "POST", url: "salesRepresentatives", data: ({ id: e.value }), dataType: "json", success: function (data) { var myObject = JSON.parse(data, function (key, value) { var type; if (value && typeof value === 'object') { type = value.type; if (typeof type === 'string' && typeof window[type] === 'function') {

View Complete Post

More Related Resource Links

invalid json parse error


i write a ajax code with jquery but it is not return the result properly, here the code

in aspx


<script type="text/javascript">

$("#btnLogin").click(function(event) {

                type: "POST",
                url: "services.asmx/HelloWorld",

Json Deserialization is giving error in IronPython



Have anyone tried json deserialization. When I tried:

>>> import json

>>> json.loads('["foo", {"bar":["baz", '"Test", 1.0, 2]}]')

I got following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files\IronPython 2.6 for .NET 4.0\Lib\json\__init__.py", line
 307, in loads
  File "C:\Program Files\IronPython 2.6 for .NET 4.0\Lib\json\scanner.py", line
42, in iterscan

Error (no data returned) when ResponseFormat:=WebMessageFormat.Json and attempting to serialize an I


I have am having an issue when attempting to return JSON data from a WCF Service.  I have tracked the issue down to the ResponseFormat:=WebMessageFormat.JSON, but I am unable to make any further progress.  


I am wanting the return types of my service to be an interface so that I have a little more control over the responses that are coming to my application.  

I know that returning an interface requires the ServiceKnownType and requires KnowsType on the objects so that they can serialize properly.  I have an example working, however, when add a property with a class that inherits from iList things go bad.  The service returns nothing.  I have confirmed via Fiddler that the content-length of the response is 0.  However if I switch the ResponseFormat to WebMessageFormat.XML it works fine and all objects are returned.  I have included as much code (and probably more) as I think is necessary.  If something else is needed, let me know. 

Any insight is greatly appreciated.


Code Notes:

If you comment out the DataMember Attribute on the Values property in TestResult class you will see that the code works perfectly when returning JSON. 

If you change the return Type of the Values Property to be TestCollection instead of ITestCollection it works as well.  

[Sharepoint 2007]Parse error when I add code behind the page to a normal aspx page ?


Hi all,

I dont need this form to be embedded into Sharepoint. I am adding this webpage into Sharepoint because i has issues due to cross-domain permission. I cannot call refresh sharepoint from my op up window  webpage. Therefore i want to add my webpage into the same domain as sharepoint.

I have added the webpage aspx form into Sharepoint from the sharepoint designer 2007. I would like to add code behind the page too.

What i have done at the moment was to create a project in visual studio for the code behind the page. I folloed this article :



Then i have added the dll intothe bin of my sharepoint site. i have also added in webconfig the dll.

However i got the following error :

Parser Error Message: The codefile attribute on the page directive is not allowed in this page.

Source Error: 

Line 1: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="FormOragniseMeeting.aspx.cs" Inherits="FormOrganiseMeeting.FormOrganiseMeetingCodeBehind" %>
Line 2: 
Line 3: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">





ConnectionString Expression to dBASE5.0 parse error



I am getting the following error:

The expression "“Provider=Microsoft.Jet.OLEDB.4.0;Data Source=” + @[User::vCurrentFilePath] + “;Extended Properties=\”dBASE 5.0\”" on property "ConnectionString" cannot be evaluated. Modify the expression to be valid.

Thanks for any help.

WDP was successful, but page gives Parse Error, Publish works successfully


I have a web application that we have built using visual studio 2008 (.net 2.0) and we are trying to use a web deployment project to deploy it to our test server.  After the project is built successfully, we try to open the page and get a "parse error" because it can't find the type specified in the Inherits statement in the aspx page.  When I use the publish command instead of the web deployment project to deploy the application it works successfuly.  The project will also run locally in debug so it doesn't appear to be anything wrong with the project.  I have noticed that the dll for the WDP build in the bin folder is only 9KB in size while when I publish the file is 177KB in size.  I have looked through the web deployment logs and can't see any problems. I also had another developer deploy using the WDP on their machine and they got the same result. Has anyone else seen this or have any ideas what is wrong?

Really Long JSON String wraps to multiple lines in source, creates unterminated String Literal error


I have an app that writes a JSON object to a string and registers a script block onto the page that client-side javascript then uses to build interface components.  I found that the javascript is working fine when the data set is small, but on large datasets, when I view the source, the JSON object string takes up a few lines because it is so long.  I didn't think anything of it until I started manually trying to recreate the "Unterminated String Literal Error", only to find that the error goes away when I format the JSON string to be a little more "readable".  What I discovered is that this does away with the automatic new line wrap, making the error go away. 

Make Sense?  Is there anything I can do about this?

Json Deserialization is giving error in IronPython



Have anyone tried json deserialization. When I tried:

>>> import json

>>> json.loads('["foo", {"bar":["baz", '"Test", 1.0, 2]}]')

I got following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files\IronPython 2.6 for .NET 4.0\Lib\json\__init__.py", line
 307, in loads
  File "C:\Program Files\IronPython 2.6 for .NET 4.0\Lib\json\scanner.py", line
42, in iterscan

xml node parse getting error while using openxml method


i'm working on importing xml data into sql using openxml method is working fine .but the data below is getting error while parse because of the single Quote or some other special character is available in <Cust_Name> that's the problem. how to solve this issue


<Cust_Name>John P O'Connell</Cust_Name> -- not working

<Cust_Name>John P OConnell</Cust_Name> -- working
Sudhesh. G

IsapiModule Error 500 Issue


I am about exhausted trying to figure out this error:

HTTP Error 500.0 - Internal Server Error

Description: The page cannot be displayed because an internal server error has occurred.

Error Code: 0x8007007b

Notification: ExecuteRequestHandler

Module: IsapiModule

Requested URL: http://localhost:80/ReportServer

Physical Path: c:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting Services\ReportServer

When I enable Failed Request Tracing Rules and view the log output I am supposing that the actual problem is in the 2nd call where there are 2 backslashes before the actual filename in the specified path:


CALL_ISAPI_EXTENSION DllName="C:\Windows\Microsoft.NET\Framework\v2.0.50727\\aspnet_isapi.dll"


Handling 404 page not found with Error page



      How do i handle 404 page not found?

Inserting personal error message in ValidationSummary



I am creating a web form that requires a lot of validation. I use many of the validation control in asp.net already like RequiredFieldValidator and CompareValidator. 

My Problem: after my custom validation for the value entered return an error message, and I pressed enter key when the field is empty, my custom error message is overlapped by my ValidationSummary. 

Setting my custom error to visible = false on button click also does not seem to work as it requires for me to enter the value first.

This made me think, is there a way to insert my custom validation inside the ValidationSummary as an error message like for other validation control?

Thanks in advance

Sys.Net.WebServiceFailedException: The server method '' failed with the following error:



Let's say we have 2 time consuming functions, aaa and aaa1 inside a aspx page.

        public static string aaa(int i)
            return i.ToString();

        public static string aaa1(int i)
            return i.ToString();



        <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
        <span id="displayspan"></span>
        <br />
        <input type="button" value=

Jscript error: Object does not support property or method


 Hi, i have little knowledge on javascript but i need to use this code get from somewhere for a jquery to work.

I face this "Jscript runtime error: Object does not support property or method" whenever im trying to run this page.

In my experience, im get this error msg 9 out of 10 times i use javascript in my system.

Im using Microsoft Visual web developer 2008, i wonder if this is related to my problem, i not sure there is anything i need to add as reference or update anything.

But anyway, in short, i just couldn't use javascript code when using this development tool because of this sort of error.

Anyway, it happen that last time i tried use the same type of jquery code in another project and it seems to work well without an error.

But now when im try to use it again in this recent project i created, it come out with this error and i have no idea how to solve it even look through google and this forum.

It doesn't really seems like its the code problem itself although im not sure, because any javascript code just couldn't work.

So below is my code that i need to use.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" ></script>
<script type="text/javascript" src=&quo

Type or namespace error.


A couple of days ago I started getting an unusual behavior when compiling Website projects. I have referenced class libraries added to my bin folder that are also correctely referenced in using statements in my aspx.cs code behind. When I compile, I get the 

Error 4 The type or namespace name 'CommonClassLibrary' could not be found (are you missing a using directive or an assembly reference?) C:\Dev\Fiscal_Portal\Implementation\FMS Portal Site_new\App_Code\BLL\DataTables.cs 1 7 C:\...\FMS Portal Site_new\

The type or namespace name 'CommonClassLibrary' could not be found (are you missing a using directive or an assembly reference?)

error message that would typically be received when the dll has not been added as a reference or added in a using statement.

I can eliminate the error by adding an


HTTP Error 403 - Forbidden


(VB Express website directed me to ASP.NET Web Services which in turn redirected me to this forum).

 Hopefully someone can help me here...... 

I am using VIsual Web Developer and downloaded the small business application to use as a starting point to help my wife get a website up for her small business. When I load the application, I can F5 and it runs fine but as soon as I make any modification to the app and hit F5, I get the HTTP Error 403 - Forbidden when it tries to show the website.

I notice a pop up that occurs when I run that allows me to choose the link for my app and it displays correctly (I close the webpage that has the error on it).

This seems like a pain, is there a setting I'm missing - I would think that this should "just work".

What's up?????



Webmatrix error


When i try to do anything in webmatrix it shuts down.   i get this error in the log

pplication: WebMatrix.exe
Framework Version: v4.0.30319
Description: The application requested process termination through System.Environment.FailFast(string message).
Message: Unrecoverable system error.
   at System.Environment.FailFast(System.String)
   at MS.Internal.Invariant.FailFast(System.String, System.String)
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend