Restful service returning components


is there way, or indeed doing wrong when creating components, components generate json consistently. json i'm returning have first letter capitalized , rest lower case when returning component restful service capitalized when calling compoent remotely.

 

some demo components below:

 

user.cfc

 

component {

     property type="numeric" name="userid";

     property type="string" name="username";

}

 

users.cfc

component output="false" restpath="/users"

{

     remote user function getbypk(required numeric id restargsource="path") output="false" httpmethod="get" restpath="{id}"

     {

          user = new user();

 

          user.userid = 1;

          user.username = "chicken";

 

          return user;

     }

}

output:

/rest/users/1.json

{"username":"chicken","userid":1.0}

/rest/users/1.xml

<component id="1" name="user">

<property name="username" type="string">chicken</property>

<property name="userid" type="string">1</property>

</component>

 

/users.cfc?method=getbypk&id=1&returnformat=json

{"username":"chicken","userid":1}

 

is quirk have put with?



More discussions in ColdFusion


adobe

Comments

Popular posts from this blog

How to set the order of FAQs instead of alphabetical

Thread: Get UK Keyboard working

how do I change the e-mail address for my merchant account