json

How do I extract purticular line from Json stdclass array??

ok this is an Api call $json_string = '"offices": [{"description": "Google Headquarters", "address1": "1600 Amphitheatre Parkway", "address2": "", "zip_code": "", "city": "Mountain View", "state_code": "CA", "country_code": "USA", "latitude": 37.421972, "longitude...

Parsing JSON string containing a RegExp in .NET

I a JSON string that contains a Regular Expression: like - { "pattern": /[a-z0-9]+/i } Is there any easy way to parse this in .NET and get resulting object/data-structure that I can use further? I tried JSON.NET's JObject.Parse() method but it throws an exception. Thanks in advance! ...

Using Json and jQuery to populate DropDown from a list of custom classes in Asp.Net MVC 2

I'm trying to populate a DropDown from a Json result using jQuery. I have the following class: class MyOption { int Id { get; set; } string Name { get; set; } } I'm not sure how to get a list of these into my Json result. At the moment I have the following, I'm not sure if it's correct but it compiles and runs: return Json(...

Cross domain content usage from client script (security issues)

Hi guys, I'm trying to load some external content using jQuery load function to div on my page. load method works ok, with local content, but if you want something out of your domain, it won't work. $("#result").load("http://extrnal.com/page.htm #data); (it actually works in IE with security warning, but refuses to work in Chrome at ...

JSON Object Array of Properties

I've been trying to figure out this particular object for quite a while and it's frustrating me endlessly so I was hoping to get it resolved here. I have an object that looks like this: options = { headers: { rows: [ cols = { text: "Blah", span: 12, color: "#FFF" ...

jqGrid with JSON showing up empty.

I'm trying to load a jqGrid from json data made via a REST call. But my grid is just a blank rectangle on the page. Here is my code: <body> <div id="tabs"> <ul> <li><a href="#panel-users">Users</a></li> <li><a href="#panel-clients">Clients</a></li> </ul> <div id="panel-users"> <table id="list"></tab...

Custom to_json method not being called in Rails app

I have a Ruby on Rails application that I'm working on an API for an associated iPhone application. I have overwritten the to_json method of my Item model to return some custom information from the API request that I'll need in the iPhone app. However, when I use the built-in rails to_json method and include my Item model as an associa...

How can I best utilize Json.NET to modify parts of an existing JSON object?

Example: I have the following JSON object. {"currentVersion" : "10.0", "folders" : [], "services" : [ {"name" : "nyc", "type" : "MapServer"}, {"name" : "philly", "type" : "MapServer"} ] } I want to be able to remove one or more items from the services array based on the value of the name attribute. For instance, I w...

getting an array of cities out of a json response

I have the following code. I am trying to get just the name of the city out of the feed that is requested, and into a new array. Can anyone give me an indication. $city = $_GET['city']; $json = @file_get_contents('http://ws.geonames.org/searchJSON?country=GB&amp;maxRows=10&amp;name_startsWith=$city'); $json = utf8_encode($json); $c...

What is the JSP equivalent to json_encode ( in PHP ) ?

I am trying to encode a JSP servlet into JSON. What's the equivalent in JSP to json_encode() in PHP ? ...

Passing JSON data to a webservice

I have two parameters (categoryName and categoryDescription) that I need to pass to the web service using JSON. I found the syntax to pass categoryName but have not been able to get the correct syntax to pass both parameters. Here is the code. <script src="js/jquery-1.4.1.min.js" type="text/javascript"></script> <script type="text/javas...

Why Ajax Jquery form click not working vs div that works?

Hi, Ajax Jquery form not working vs div why its happen and how can i fix my error? view.html-Code with form not working <html> <head> <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"&gt;&lt;/script&gt; </head> <body> <form id="parse-form" action="#" method="post"> <butt...

PHP functions not available - json_decode

Based on my php_info() my PHP version is PHP Version 5.2.9 However, for some reason when i try and use json_decode, I receive an error that the function is not found (and it should be for PHP 5.2 and up). PHP.net suggests I check the configure command: './configure' '--prefix=/usr/local/php5' '--with-config-file-scan-dir=/usr/local/p...

Getting static data for Flash app with JSON or XML - caching or not?

Hey, I've flash app and i've static data (like ~18.0KB) for it which aren't changed often so I was wondering how to better get them. The static data may be in XML or JSON. One of my ideas was to put the static data in .js file within a function which would return them in JSON list and the other one was to return them in XML (as I like to...

Book suggestion on this DDD concept specific to ASP.NET MVC and JSON?

I am looking for a book or blog entry on the following DDD concepts, something specific to MVC and C# code. Quick summary: partially populated domain models from special repository methods and sending only changed domain model properties as JSON back from the client. More details: If you have a Customer object but need a drop down li...

How can I customize the deserialization of JSON in ASP.NET MVC?

I have a controller action that is receiving a complex object via JSON. The object has a property on it that is declared as an abstract type. Currently, the action method never gets executed because when the JSON object is deserialized it chokes on the abstract type. How can I customize the deserialization phase so that I can supply th...

What is the best approach to do ASP.NET MVC & AJAX via JSON?

In ASP.NET webforms I used to write AJAX apps where the client would communicate to the server using web services or page methods and JSON. I'm new to ASP.NET MVC and have found that one could use web services or controller actions that use JSON. Are there other options? Should I use web services or controller actions and why? ...

Convert large JSON file to MySQL

I have a ~1MB JSON file that needs to be converted to MySQL. The file has close to 400 records. What is the best way to do this using PHP ? If i try to add 400 records in a single pass, I either get the memory or execution time error. Whats the best way around this ? ...

ASP.Net MVC (1) - how can I pass JSON to view but not as separate ajax call...

I have some data that I want to pass into the View (.aspx page) in JSON format. I could add an async ajax call and load it that way, but since I have the data upfront, why not just dump it into the view. I could pass a C# object as the model and in Javascript manually iterate through it to fill out a Javascript object, but this seems l...

jquery iterate through dynamic complex object submit to asp.net mvc action

I'm trying to iterate through a complex type binding in jQuery to submit the Json representation through to an IEnumerable action parameter. Html <input type="hidden" value="0" name="value.index" /> <input type="text" value="textone" name="value[0].InputValue" id="value[0].InputValue" /> <input type="hidden" value="0" name="value[0].Id...