Score:0

views Serializer in REST export field to add token

cn flag

I have pull data from the outside via Views JSON Source plugin, I changed via contextual filters, and one of the examples I got looks like this.

[{"value_1":"Adelaide (87)"},{"value_1":"Adelaide City Center (871)"},{"value_1":"Adelaide East (871)"},{"value_1":"Adelaide North East (871)"},{"value_1":"Adelaide North West (871)"},{"value_1":"Adelaide South (871)"},{"value_1":"Adelaide West (871)"},{"value_1":"Albury (260)"},{"value_1":"Alice Springs (889)"},{"value_1":"Armadale (861)"},{"value_1":"Avalon Beach (284)"},{"value_1":"Ballarat (343)"},{"value_1":"Bankstown (281)"},{"value_1":"Beenleigh (730)"},{"value_1":"Bendigo (344)"},{"value_1":"Blacktown (286)"},{"value_1":"Brisbane (73)"},{"value_1":"Brisbane City Center (730)"},{"value_1":"Brisbane East (739)"},{"value_1":"Brisbane North East (736)"},{"value_1":"Brisbane North\/north West (735)"},{"value_1":"Brisbane South East (730)"},{"value_1":"Brisbane West\/south West (737)"},{"value_1":"Bunbury (897)"},{"value_1":"Bundaberg (743)"},{"value_1":"Cairns (742)"},{"value_1":"Caloundra (caboolture) (753)"},{"value_1":"Canberra (261)"},{"value_1":"Clayton (385)"},{"value_1":"Cleveland (730)"},{"value_1":"Craigieburn (383)"},{"value_1":"Croydon (382)"},{"value_1":"Dandenong (387)"},{"value_1":"Darwin (879)"},{"value_1":"Dubbo (258)"},{"value_1":"Dural (284)"},{"value_1":"Eltham (384)"},{"value_1":"Engadine (285)"},{"value_1":"Fremantle (862)"},{"value_1":"Geelong (342)"},{"value_1":"Gosford (243)"},{"value_1":"Herne Hill (861)"},{"value_1":"Hobart (361)"},{"value_1":"Ipswich (730)"},{"value_1":"Kalamunda (861)"},{"value_1":"Kalkallo (381)"},{"value_1":"Launceston (363)"},{"value_1":"Liverpool (281)"},{"value_1":"Mackay (748)"},{"value_1":"Maitland (sa) (888)"},{"value_1":"Mandurah (pinjarra) (895)"},{"value_1":"Mclaren Vale (872)"},{"value_1":"Melbourne (38)"},{"value_1":"Melbourne City And South (386)"},{"value_1":"Melbourne East (388)"},{"value_1":"Melbourne North East (384)"},{"value_1":"Melbourne South East (385)"},{"value_1":"Melbourne West (383)"},{"value_1":"Mildura (340)"},{"value_1":"Mount Barker Sa (872)"},{"value_1":"Mount Barker Sa (872)"},{"value_1":"Newcastle (240)"},{"value_1":"Orange (253)"},{"value_1":"Parramatta (286)"},{"value_1":"Perth (86)"},{"value_1":"Perth City And South West (862)"},{"value_1":"Perth East\/south East (862)"},{"value_1":"Perth North East (862)"},{"value_1":"Perth North\/ North West (862)"},{"value_1":"Perth West (862)"},{"value_1":"Point Cook (383)"},{"value_1":"Port Macquarie (wauchope) (255)"},{"value_1":"Redcliffe (730)"},{"value_1":"Ringwood (388)"},{"value_1":"Rockhampton (748)"},{"value_1":"Rottnest (861)"},{"value_1":"Salisbury (872)"},{"value_1":"Samford (730)"},{"value_1":"Sandgate (731)"},{"value_1":"Shepparton (358)"},{"value_1":"Spearwood (861)"},{"value_1":"Sunbury (380)"},{"value_1":"Sutherland (285)"},{"value_1":"Sydenham (383)"},{"value_1":"Sydney (28)"},{"value_1":"Sydney North (284)"},{"value_1":"Sydney North West (286)"},{"value_1":"Sydney South West (285)"},{"value_1":"Sydney South\/south East (283)"},{"value_1":"Sydney West (281)"},{"value_1":"Tamworth (257)"},{"value_1":"Terrey Hills (284)"},{"value_1":"Toowoomba (745)"},{"value_1":"Townsville (744)"},{"value_1":"Tweed Heads (beaudesert) (756)"},{"value_1":"Wagga Wagga (259)"},{"value_1":"Wanneroo (862)"},{"value_1":"Werribee (380)"},{"value_1":"Whittlesea (381)"},{"value_1":"Wollongong (242)"},{"value_1":"Woodside Sa (872)"}]

And what I need is should look like this:

[{"Adelaide (87)":"Adelaide (87)"},{"Adelaide City Center (871)":"Adelaide City Center (871)"},{"Adelaide East (871)":"Adelaide East (871)"},{"Adelaide North East (871)":"Adelaide North East (871)"},{"Adelaide North West (871)":"Adelaide North West (871)"}...

So "value_1" needs to be the same as the value, I can only use fields are the working entity is not available and in Fields, I can only change the alias, and that is back me to the same value for all data lists. Is there any possibility to get a token to use on the field, or there is another approach to achieve this? Here below are screenshots of the actual view.

this is options for field This is the only option I can change

this is how to view setup looks like

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.