This should be an easy one but for some reason the answer is escaping me.

I am executing a query with joins that includes projected fields (fields from one of the joined lists) using JSOM.

Using server side code, the type of one of these field values is String and has a value in the format of "ID;#Value".

Using JSOM, how do I get the value of this field? When I call the .toString() method on the field value, I get "[object Object]". If I call typeof() on the field value, I get "string". What am I missing?


The following appears in the query XML...

  <Field Name="LastName" Type="Lookup" List="Employees" ShowField="LAST_NAME" />
  <FieldRef Name="LastName" />

The following server-side code...


...will yield something like "1;#Smith".

The following client-side code...


...will yield "[object Object]". The type of this field value is indeed string (just as it was for the server-side code) as evidenced by the statement...


...which yields "string".

Again, the question is how do I get the value "1;#Smith" using the client-side code?


2 Answers 2


Your field is a lookup field, wich is represented by a complex type SP.FieldLookupValue on the client side. You can retrieve the label and id as shown below:

var lastNameValue = item.get_item('LastName');
var lastNameLabel = lastNameValue.get_lookupValue();
var lastNameId = lastNameValue.get_lookupId();
  • Thank you for the help. The fact that the type of the value was being reported as string was confusing. After thinking about it a bit longer, I guess this is how the server-side code behaves (sort of). Jan 23, 2015 at 19:57

I suggest you use Fiddler (http://www.telerik.com/fiddler) to inspect the raw JSON being returned from the service call. Seeing what the raw data looks like should help you understand how it's represented in JavaScript.

enter image description here

  • Thank you for the response. I marked the other answer as the solution as it took my issue to completion. I couldn't even up-vote your answer as I do not have enough reputation points. Jan 23, 2015 at 19:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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