I'm using RESTws and POSTing a JSON object to "/node". Everything works fine until I include a List text field (checkbox type). The field in question is:

"field_days_closed_v": ["Monday", "Tuesday"],

When I post I get this error:

Recoverable fatal error: Argument 2 passed to RestWSBaseFormat::getResourceReferenceValue() must be of the type array, string given, called in .../restws/restws.formats.inc on line 278 and defined in RestWSBaseFormat->getResourceReferenceValue() line 311

My JSON is:

  "body": {
    "format": "filtered_html",
    "summary": "",
    "value": "test"
  "field_opening_times_t": {
    "format": "filtered_html",
    "value": "Daily"
  "field_price_category": "",
  "field_price_text_t": {
    "format": "filtered_html",
    "value": "<p>Free entry</p>"
  "title": "Mark test test test",
  "type": "primary_article"

The field is a List(text) and the widget type is Check boxes/radio buttons. Values are:


Am I right in thinking it is just an array that should be POSTed?

Any ideas?

  • I don't see field_days_closed_v in your JSON format!. Where is it? and I'm pretty sure that the JSON format in my answer works for the field type you mentioned. So try to send the exact JSON format (by ignoring other fields) and see. – Krishna Mohan Dec 16 '14 at 10:56

The JSON format for list (text) for checkbox type would looks like follows

{"title":"My Day","type":"page","field_days_closed_v":{"und":["sunday", "monday"]}}

I've tested this, and working fine.

Here field_days_closed_v is the machine name of the List text field (checkbox type). similarly sunday, monday are the values of checkbox type so change them accordingly.

Hope this helps. :)

  • 1
    @MarkRobson Sorry for the delay. Can you post your complete JSON format here. It seems issue with other fields – Krishna Mohan Dec 15 '14 at 11:54
  • 1
    @MarkRobson Does it works fine without "£"? Have you checked that? – Krishna Mohan Dec 19 '14 at 12:38
  • 1
    @MarkRobson Have a look at this post - How to escape special characters in building a JSON string? – Krishna Mohan Dec 19 '14 at 12:54
  • 1
    @MarkRobson I use POSTER Add-on for Firefox to send json format to rest service. I didn't have time to check your scenario. I'll try to do that today. :) – Krishna Mohan Dec 22 '14 at 9:32
  • 1
    @MarkRobson I was busy yesterday. Just checked your scenario. It's working fine, even I add £ ot JSON format. If that doesn't work for you try something like "field_text":{"und":[{"value":"\u00a3"}]} for pound symbol. – Krishna Mohan Dec 23 '14 at 11:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.