Quantcast
Channel: Mockaroo Community Forum - Latest posts
Viewing all articles
Browse latest Browse all 2665

From_dataset: select data by comparing 2 mongo ids

$
0
0

How did you manage to get the JSON data into your dataset? I am only able to get csv data up there. I know the dataset FAQ says it works with JSON, but I have not been able to load that format. I always get a parse error asking if the file was UTF8 CSV. I tried different extensions (txt, csv, json), same thing each time.

I am not able to run your first example because I don’t have access to your lookup dataset and the samples you posted just give errors when I attempt to load them as mentioned above.

That said, I did the following:

  1. Loaded a csv file containing this:
second_col,first_col
testing,"{""id"":""first""}"

Note the 2 double-quotes where a single double-quote normally would go and that the JSON object is surrounded by quotes.

  1. With the csv file I posted above, the following two hard-coded criteria values worked for me;
from_dataset("license", "first_col", second_col: "testing")
from_dataset("license", "second_col", first_col: "{\"id\":\"first\"}")

As well as referencing the values via a field reference (the “id” field in the last row criteria is the “id” field on the first row):

This works only with the entire JSON object as the search value - I’m not able to parse into it either.

If you could tell me how you got the json object up as a dataset, I could play around some more, but otherwise, this is the best I could do.

Also, using “=>” never worked for me. I always had to use ": " in the criteria.


Viewing all articles
Browse latest Browse all 2665

Trending Articles