Here is an example:
var clientContext = SP.ClientContext.get_current();
var list = clientContext.get_web().get_lists().getByTitle("Title");
var item = list.getItemById(id);
var fieldValuesAsText = item.get_fieldValuesAsText();
clientContext.load(fieldValuesAsText);
clientContext.executeQueryAsync(function (sender, args) {
var fieldValues = fieldValuesAsText.get_fieldValues(); // Text values of all fields
var fieldValue = fieldValuesAsText.get_item('Title'); // Text value of one field
}, function (sender, args) {
alert(args.get_message());
});
Update, get field values as text of all items in one executeQueryAsync call:
var clientContext = SP.ClientContext.get_current();
var list = clientContext.get_web().get_lists().getByTitle("Title");
var items = list.getItems(new SP.CamlQuery());
clientContext.load(items, 'Include(FieldValuesAsText)');
clientContext.executeQueryAsync(function (sender, args) {
var enumerator = items.getEnumerator();
while (enumerator.moveNext()) {
var item = enumerator.get_current();
var fieldValuesAsText = item.get_fieldValuesAsText();
var fieldValues = fieldValuesAsText.get_fieldValues();
console.log(fieldValues);
}
}, function (sender, args) {
alert(args.get_message());
});
get_fieldValuesAsTest
?http://siteurl//_api/web/lists/getbytitle('listitle')/item(itemId)/fieldvaluesastext