Are there plans for PM variables saved using the pm method retain their data type?

Hi.
Just a simple question if variables saved using pm.environment.set(“name”, path) will eventually keep their data type?
Given I have saved an environment variable which was a number, let’s say 35.
And in a different endpoint, I want to assert the correct value is returned.
The below will fail as the postman variable is now a string.

    pm.test('Summary.Count = ' + environment.reviewCount, function() {
        pm.expect(summary[0].count).to.equal(environment.reviewCount);
    });

The above will fail, but the below will pass:

    pm.test('Summary.Count = ' + environment.reviewCount, function() {
        pm.expect(summary[0].count).to.equal(parseInt(environment.reviewCount));
    });

I’m just wondering if there’s plans, when using the new pm method, to keep the data types instead of conveting everything to strings?

2 Likes

Yep. They should retain their data type. @kunagpal Can you clarify this?

We have a feature on the roadmap that will allow everyone to edit complex data types inline so if it doesn’t work right now, it should be possible in the next couple of weeks.

Yes, this is on the roadmap. We’re currently working on app-side improvements to streamline the user experience for such nested types. For now, you’ll have to use the stringify/parse routine.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.