How to get "int" value in json as "string" using metamug

eg: i get [{"id":100}]

while I require: [{"id":"100"}]

+3


source to share


1 answer


You need to send an integer value as a string. To convert an integer to a string, you can use the CONCAT () function.

Something like that.

<?xml version="1.0" encoding="UTF-8" ?>
<Resource xmlns="http://xml.metamug.net/resource/1.0" v="1.1">
    <Request method="GET">
        <Query> 
           select CONCAT('',100) as 'id'
        </Query>
    </Request>
</Resource>

      

As a result, json will have a value as a string.



[{"id": "100"}]

      

Alternatively, using the CAST () function will also give the same result.

    <Query> 
        select CAST(100 as char(5)) as 'value'
    </Query>

      

+1


source







All Articles