English 中文(简体)
纽约总部 Kit没有把简单的JSON从营地打下?
原标题:JSONKit failed to parse simple JSON from php?

I am using JSONKit in my iOS app. It loads an extremely simple JSON served by my php file:

rel=“nofollow” http://staging.comwerks.net/terrence/ecitizen/article.php

somehow, it is producing an error: "Unexpected token, wanted { , } , [ , ] , , , : , true , false , null , "STRING" , NUMBER .}

当我试图使用http://jsonlint.com/至 lint my URL above。 它给人以同样的错误,对公开的 br!

我的营地必须更加简单:

<?php
header( Content-type: application/json );
$json = array( a  => 1,  b  => 2,  c  => 3,  d  => 4,  e  => 5);
echo json_encode($json);
?>
最佳回答

在答复开始时,它可能会抱怨统法协会的定章。 如果我把产出复制并贴上斜线,它就会验证。 这很可能是在您的文章开始之时。 php档案。 你的文字编辑应选择不这样做(可能的话在“拯救As...方言”中)。

问题回答

我同意尼克。 当我把json直接拖到档案中时,我的编辑说,编码是UTF-8与BOM。

此外,你使用的JSON验证师给我这个错误:

JSON 差错: 未能得到承认?





相关问题
JQuery/MVC Search Issue

I have inherited a piece of work where the entry screen shows a summary of 20 calculated variables. E.g. Var A (250), Var B (79). Clicking on any of these links takes the user to a view with a ...

jQuery quicksearch plug-in tinkering with JSON

I ve implemented the quicksearch plugin by Rik Lomas and I love it for an application in a custom CMS I m building. I was wondering though, since I m going to have a bizillion items in the table if ...

JSON with classes?

Is there a standardized way to store classes in JSON, and then converting them back into classes again from a string? For example, I might have an array of objects of type Questions. I d like to ...

PHP json_decode question

i m trying to use json_decode to combine a few json objects and then re-encode it. my json looks like: { "core": { "segment": [ { "id": 7, "...

Converting JSON data to Java object

I want to be able to access properties from a JSON string within my Java action method. The string is available by simply saying myJsonString = object.getJson(). Below is an example of what the string ...

热门标签