ssv-reader: problems with empty slots

Hi there,
have testdate in a ssv-file like the following

deviceId;deviceInfo;handle;provider;subs
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx;xxxxxx xx/a.b.c/xxxxx/xxxxxxx,y/xxxxxxx/29;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;xxxx;[{“geometry”:{“type”:“Point”,“coordinates”:[7.967254027736427,53.58434120325033]},“geometryType”:0,“label”:"",“type”:0,“id”:“1234567809123.0”,“enabled”:true}]

Slot subs contains a stringified JSON expression, which is used to generate a request body for a post request.
However, in case that “label” : “”, the log shows, that the body does contain only one double quote

stringData={

“handle” : “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”,

“subscriptions” : [{“geometry”:{“type”:“Point”,“coordinates”:[7.967254027736427,53.58434120325033]},“geometryType”:0,“label”:",“type”:0,“id”:“1234567809123.0”,“enabled”:true}]

}

Double quote has a special meaning: it’s used for delimiting a String that might contain reserved characters, such as the one used as a separator AND double quote itself.

I could expose a way to customize the character used as “double quote” but of course, there’s always a risk that the new character you set is also used somewhere else.

The proper way is to properly wrap your JSON string with double quotes, and escape all the inner double quotes with a backslash.

Thanks for your suggestion, but then how to insert the escaped JSON into a request body in Scala?

Wouldn’t it be simpler to provide an optional parameter in SSV, CSV etc in order to specify the string delimiter as in the CSVParser-Class?

The CSVParser will automatically unescape.

But then, are you sure it wouldn’t make more sense to use body templates, and only have the values to be replaced in the feeder?

I use a body template, which takes an array of JSON objects, contained in slot subs.

Just pushed the feature in master: https://github.com/excilys/gatling/issues/1684

thanks