FAQ
Hi,

I'm using the next code to encode the struct to json format:

response, err := json.MarshalIndent(simpleResponse, "", " ")


And, the produced output is the next:

<https://lh6.googleusercontent.com/-pQwxprtOqo0/UuT5zbDYUjI/AAAAAAAAAEc/jH6S_GvXUQo/s1600/Screen+Shot+2014-01-26+at+2.04.01+PM.png>

The original content is the next:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="urn:IJEEwsdl" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:IJEE.test_search>
<user_name xsi:type="xsd:string">kredito</user_name>
<user_password xsi:type="xsd:string">KffUaj34</user_password>
<q_type xsi:type="xsd:string">F</q_type>
<q_query xsi:type="xsd:string">200460105</q_query>
</ns1:IJEE.test_search>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Question:
Could I configure the json Marshal that way, that it would not encode the
special characters, like < and >, so I receive the human-friendly output?
I haven't found anything that I think can help me in the encoding/json docs.

Thanks


--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Minux at Jan 26, 2014 at 6:09 pm

    On Sun, Jan 26, 2014 at 7:07 AM, Павел Поляков wrote:

    Hi,

    I'm using the next code to encode the struct to json format:

    response, err := json.MarshalIndent(simpleResponse, "", " ")


    And, the produced output is the next:
    The original content is the next:
    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="
    http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="
    http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:IJEEwsdl"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="
    http://www.w3.org/2001/XMLSchema-instance" SOAP-ENV:encodingStyle="
    " rel="nofollow">http://schemas.xmlsoap.org/soap/encoding/">
    <SOAP-ENV:Body>
    <ns1:IJEE.test_search>
    <user_name xsi:type="xsd:string">kredito</user_name>
    <user_password xsi:type="xsd:string">KffUaj34</user_password>
    <q_type xsi:type="xsd:string">F</q_type>
    <q_query xsi:type="xsd:string">200460105</q_query>
    </ns1:IJEE.test_search>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>

    Question:
    Could I configure the json Marshal that way, that it would not encode the
    special characters, like < and >, so I receive the human-friendly output?
    I haven't found anything that I think can help me in the encoding/json
    docs.
    '<', '>', '&' are encoded because of security implications, and you can't
    disable this feature.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedJan 26, '14 at 12:07p
activeJan 26, '14 at 6:09p
posts2
users2
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase