zoukankan      html  css  js  c++  java
  • SOE之JSONObject

    Work with JSON in a REST SOE

    private byte[] SampleOperHandler(NameValueCollection boundVariables, JsonObject
        operationInput, string outputFormat, string requestProperties, out string
        responseProperties)
    {
        responseProperties = null;
        string parm1Value;
        bool found = operationInput.TryGetString("parm1", out parm1Value);
        if (!found || string.IsNullOrEmpty(parm1Value))
            throw new ArgumentNullException("parm1");
        ...
    }

    参考:https://developers.arcgis.com/enterprise-sdk/guide/net/work-with-json-in-a-rest-soe-net/

     // Create an empty .NET list of JsonObjects.
    List < JsonObject > jsonGeometries = new List < JsonObject > ();
    // Optionally, you could start a loop here.
    JsonObject jsonResultsGeometry = Conversion.ToJsonObject(resultsGeometry);
    jsonGeometries.Add(jsonResultsGeometry);
    // You would end the optional loop here.
    // Add the list of json objects to a final json object as an array.
    JsonObject resultJsonObject = new JsonObject();
    resultJsonObject.AddArray("geometries", jsonGeometries.ToArray());
    // Get byte array of json and return results.
    byte[] result = Encoding.UTF8.GetBytes(resultJsonObject.ToJson());
    return result;

    浏览器端接收到数据之后,可以进行解析。

  • 相关阅读:
    礼物
    Hibernate 笔记 HQL查询 条件查询,聚集函数,子查询,导航查询
    Hibernate get 和 load区别
    JS
    JS
    JS
    JS
    JS
    JS
    JS
  • 原文地址:https://www.cnblogs.com/2008nmj/p/15739591.html
Copyright © 2011-2022 走看看