Convert Roman Numerals using Object?

I was looking into a possible option of solving the challenge by using a JSON Structure for mapping the roman numerals

 var romanNumerals = {
   1: 'I',
   4: 'IV',
   5: 'V',
   9: 'IX',
   10: 'X',
   40: 'XL',
   50: 'L',
   90: 'XC',
   100: 'C',
   400: 'CD',
   500: 'D',
   900: 'CM',
   1000: 'M'
 };

but I am not sure how can I go about this?

Does it make sense to use a JSON as an mapping entity here?

this isn’t really JSON. This is a javascript object.
And yes, of course you can use an object to map the values to the numerals.

ps. for this to be called JSON you would not have a variable in front of the object.

I was thinking of using Object.keys(romanNumerals) to extract the keys and then compare them with the input number.

P.S. sorry for the mashup between Object and JSON.

sure that would work but keep in mind that the keys will be strings , not numbers.
A nested array would be better if you wanted to do numerical comparisons.

here’s what keys gives if you apply it to the object