2
votes

For the Domino Data Services which is new with 8.53 and the XPages Extension library I want to turn off the @ that prepends all properties that are returned in the JSON data from a REST API call.

e.g. currently it looks like this:

  "@title":"($DircatConfig)",
  "@folder":false,
  "@private":false,
  "@modified":"2012-02-03T14:50:03Z",
  "@unid":"50458575F2AA5F918525690D004F0AB5",
  "@href":"http:\/\/192.168.1.30:80\/names.nsf\/api\/data\/collections\/unid\/50458575F2AA5F918525690D004F0AB5"

The @ symbol is causing me grief in Javascript frameworks which can bind to the data directly as you cannot use the dot notation to bind to individual property names if the include an @.

The framework I am trying is http://angularjs.org/ and an example bind might be

{{databases.@title}} <-- doesnt work whereas {{databases.title}} <--works

I have tagged this as XPages as its related to the extension library.

1

1 Answers

5
votes

The attribute names are set in the class com.ibm.domino.services.rest.RestServiceConstants of the extlib, for example:

...
public static final String ATTR_UNID = "@unid"; //$NON-NLS-1$   
public static final String ATTR_NOTEID = "@noteid"; //$NON-NLS-1$
public static final String ATTR_LINK = "@link"; //$NON-NLS-1$
public static final String ATTR_LINK_REL = "rel"; //$NON-NLS-1$
public static final String ATTR_LINK_HREF = "href"; //$NON-NLS-1$
...

Since they are public static final Strings, you would have to extend DAS and use your extended classes.

However I believe you should be able to access the attributes in this manner instead of dot notation:

database['@title']

Hope this helps.