Re: Removind duplicates for JSON string

2020-11-01 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 1 November 2020 at 13:31:19 UTC, Anonymouse wrote: On Sunday, 1 November 2020 at 09:14:35 UTC, Vino wrote: [...] I can only test with Phobos (no asdf on run.dlang.io), but isn't just normal sort and uniq what you want? data[] .array .sort .uniq!((tup1, tup2) => tup1[0

Re: Removind duplicates for JSON string

2020-11-01 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 1 November 2020 at 09:14:35 UTC, Vino wrote: [ Tuple!(string, string)("DEV", "D1"), Tuple!(string, string)("DEV", "default"), Tuple!(string, string)("DEV", "D1"), Tuple!(string, string)("QAS", "Q1"), Tuple!(string, string)("QAS", "Q1"), Tuple!(string, string)("QAS", "default"),

Removind duplicates for JSON string

2020-11-01 Thread Vino via Digitalmars-d-learn
Hi All, Request your help on how to remove duplicates in JSON. Code: import asdf; import std.algorithm : map, filter, uniq; import std.container.array; import std.stdio : writeln; import std.typecons : Tuple, tuple; import std.array; void main() { string apidata = `{ "items": [ { "name