Android的JSON Array返回TRANSFORM_ERROR:103 [英] Android JSON Array Returns TRANSFORM_ERROR: 103

查看:161
本文介绍了Android的JSON Array返回TRANSFORM_ERROR:103的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

刚开始使用 AndroidQuery 以JSON异步任务和Im不熟悉使用JSON性反应的codeS。 Befor使用AQ的方法,我不是得到任何错误,但现在我得到了103 TRANSFORM_ERROR。

下面是JSON字符串,我的code片段。任何想法我可能有错了吗?日Thnx

通过PHP JSON返回:

  {项目:[{_ ID:1,标签:交流,称号:顾问式循环,说明:提供指导诸如方法,程序,和用于与规定和要求符合惯例,日期:2008-03-03,gotoURL:空},{_ id为:2,标签: AD,称号:适航指令,说明:适用于飞机,飞机发动机,螺旋桨和电器依法强制执行的规则。,日期:2012-06-08,gotoURL :JavaScript的:navClickListener('的BodyContent',DNS +\ /维基\的index.php \ / Airworthiness_Directive#内容);},{_ ID:3,标签:CFR 头衔:说明美国联邦法规code:在CFR的标题14正式规则制定的文件,并已发表在联邦纪事,日期:2012-01-31, gotoURL:JavaScript的:navClickListener('的BodyContent',DNS +\ /维基\的index.php \ / Main_Page#内容);},{_ ID:4,标签:PMA ,称号:零部件制造人批准,说明:零部件制造人批准,日期:2012-01-31,gotoURL:空},{_ ID:5, 标签:SAIB,称号:特殊适航信息公告,说明:由厂商提供修改或检查的指令发出公告。,日期:2012-01-31, gotoURL:空},{_ ID:6,标签:SFAR,称号:特殊联邦航空条例,说明:已经改变了CFR的语言正式规则制定的文件在标题14 CFR航空,日期:2012-01-31,gotoURL:空},{_ ID:7,标签:STC,称号:补充型号证书,说明:由美国联邦航空管理局批准产品(飞机,发动机,或螺旋桨)修改,当日之已发行文件:2012-01-31,gotoURL:空}, {_id:8,标签:祖,称号:技术标准令,说明:用于指定的材料,零部件,工艺颁发的FAA最低性能标准和电器民用航空器,日期:2012-01-31,gotoURL:空},{_ ID:9,标签:TCDS,称号:型号合格证数据床单,说明:Make和飞机,发动机和螺旋桨的型号信息,包括空速,重量和推力限制等资源库,日期:2012-01-31,gotoURL:空}]}
 

MainActivity:

 公共类MainActivity扩展活动实现AnimationLayout.Listener
{
    @覆盖
    公共无效的onCreate(包savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        的setContentView(R.layout.main);
        ...
        async_array();
    }

    AQuery AQ;
    静态JSONArray jArray;
    JSON字符串= NULL;

    公共无效async_array()
    {
        AQ =新AQuery(本);
        字符串URL =htt​​p://192.168.1.11/Andaero/php/regulatory_list.php;
        aq.ajax(URL,JSONArray.class,新AjaxCallback< JSONArray>()
    {

        @覆盖
        公共无效回调(字符串URL,JSONArray JSON,AjaxStatus状态)
        {

        如果(JSON!= NULL)
        {

        //成功的Ajax调用,显示状态code,json的内容
        // jsonListCallback(JSON);
        Toast.makeText(aq.getContext(),status.get code()+:+ json.toString(),Toast.LENGTH_LONG).show();

        }

        开关(status.get code())

        {

            案例AjaxStatus.TRANSFORM_ERROR:
            Toast.makeText(aq.getContext(),TRANSFORM_ERROR:+ status.get code(),Toast.LENGTH_LONG).show();
            打破;
            案例AjaxStatus.NETWORK_ERROR:
            Toast.makeText(aq.getContext(),NETWORK_ERROR+ status.get code(),Toast.LENGTH_LONG).show();
            打破;
            案例AjaxStatus.AUTH_ERROR:
            Toast.makeText(aq.getContext(),AUTH_ERROR+ status.get code(),Toast.LENGTH_LONG).show();
            打破;
            案例AjaxStatus.NETWORK:
            Toast.makeText(aq.getContext(),网络+ status.get code(),Toast.LENGTH_LONG).show();
            打破;
            默认:
            Toast.makeText(aq.getContext(),其他错误+ status.get code(),Toast.LENGTH_LONG).show();
            打破;

        }
        }
    });
    }
 

解决方案

它不喜欢

  

项目:。 。 。

字段。我删除了它,现在它的作品。

just started using AndroidQuery for JSON asynchronous tasks and Im not familiar with JSON Responce codes. Befor using the AQ methods, I wasnt getting any errors but now I get the 103 TRANSFORM_ERROR.

Below is the JSON string and my code snippets. Any Ideas to what I may have wrong? Thnx

JSON returned via php:

{"items":[{"_id":"1","label":"AC","title":"Advisory Circulators","description":"Provides guidance such as methods, procedures, and practices for complying with regulations and requirements.","date":"2008-03-03","gotoURL":null},{"_id":"2","label":"AD","title":"Airworthiness Directives","description":"Legally enforceable rules that apply to aircraft, aircraft engines, propellers, and appliances.","date":"2012-06-08","gotoURL":"javascript:navClickListener('bodyContent', dns + '\/wiki\/index.php\/Airworthiness_Directive #content');"},{"_id":"3","label":"CFR","title":"Code of Federal Regulations","description":"Official Rulemaking documents of the CFR in Title 14 and have been published in the Federal Register","date":"2012-01-31","gotoURL":"javascript:navClickListener('bodyContent',  dns + '\/wiki\/index.php\/Main_Page #content');"},{"_id":"4","label":"PMA","title":"Parts Manufacturer Approvals","description":"Parts Manufacturer Approvals","date":"2012-01-31","gotoURL":null},{"_id":"5","label":"SAIB","title":"Special Airworthiness Info Bulletins","description":"Bulletins issued by manufacturers to provide modification or inspection instructions.","date":"2012-01-31","gotoURL":null},{"_id":"6","label":"SFAR","title":"Special Federal Aviation Regulation","description":"Official Rulemaking documents that have changed the language of the CFR in Title 14 CFR for aviation.","date":"2012-01-31","gotoURL":null},{"_id":"7","label":"STC","title":"Supplemental Type Certificates","description":"Document issued by the Federal Aviation Administration approving a product (aircraft, engine, or propeller) modification","date":"2012-01-31","gotoURL":null},{"_id":"8","label":"TSO","title":"Technical Standard Orders","description":"Minimum performance standards issued by the FAA for specified materials, parts, processes, and appliances used on civil aircraft.","date":"2012-01-31","gotoURL":null},{"_id":"9","label":"TCDS","title":"Type Certificate Data Sheets","description":"Repository of Make and Model information of aircraft, engine or propeller including airspeed, weight, and thrust limitations, etc.","date":"2012-01-31","gotoURL":null}]}

MainActivity:

public class MainActivity extends Activity implements AnimationLayout.Listener
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        ...
        async_array();
    }

    AQuery aq;
    static JSONArray jArray;
    String json = null;

    public void async_array()
    {
        aq = new AQuery(this);
        String url = "http://192.168.1.11/Andaero/php/regulatory_list.php";
        aq.ajax(url, JSONArray.class, new AjaxCallback<JSONArray>()
    {

        @Override
        public void callback(String url, JSONArray json, AjaxStatus status)
        {

        if (json != null)
        {

        // successful ajax call, show status code, json content
        // jsonListCallback(json);
        Toast.makeText(aq.getContext(), status.getCode() + ":" + json.toString(), Toast.LENGTH_LONG).show();

        }

        switch (status.getCode())

        {

            case AjaxStatus.TRANSFORM_ERROR:
            Toast.makeText(aq.getContext(), "TRANSFORM_ERROR: " + status.getCode(), Toast.LENGTH_LONG).show();
            break;
            case AjaxStatus.NETWORK_ERROR:
            Toast.makeText(aq.getContext(), "NETWORK_ERROR " + status.getCode(), Toast.LENGTH_LONG).show();
            break;
            case AjaxStatus.AUTH_ERROR:
            Toast.makeText(aq.getContext(), "AUTH_ERROR" + status.getCode(), Toast.LENGTH_LONG).show();
            break;
            case AjaxStatus.NETWORK:
            Toast.makeText(aq.getContext(), "NETWORK" + status.getCode(), Toast.LENGTH_LONG).show();
            break;
            default:
            Toast.makeText(aq.getContext(), "OTHER ERROR" + status.getCode(), Toast.LENGTH_LONG).show();
            break;

        }
        }
    });
    }

解决方案

It didn't like the

"items":[. . . "

field. I removed it and now it works.

这篇关于Android的JSON Array返回TRANSFORM_ERROR:103的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆