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;

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

  • 相关阅读:
    Kafka Kerberos客户端访问
    Kafka Kerberos服务端配置
    Centos安装Kafka
    aaaaaaaaaaaa
    Kafka队列消息和发布订阅消息
    RabbitMQ概念
    RabbitMQ使用
    windows下安装Erlang
    RabbitMQ简介
    Flume简介
  • 原文地址:https://www.cnblogs.com/2008nmj/p/15739591.html
Copyright © 2011-2022 走看看