On 11/08/2021 15.54, chinna wrote:
> Hi All,
> 
> I am actually working on a use case where I have to convert the JSON
> data into a dictionary and from that  I will have to replace all the
> keys and values to the data types. 

The data type is returned as a string with the builtin type() function.

> For example:
> 
> input_dict  = {'segment_idenifier': 'Segment 2',
> 'exposed_pipe_outside_diam': 4, 'exposed_pipe_length': 2}
> 
> output_dict = {string : string, string : integer, string : integer } 
> 
> in some cases the dictionary will have nested dictionaries or lists as
> well. If it has, we will have to replace the key-values inside those
> nested objects.
> 

The JSON library included with the Python standard supports nested
objects (converting them into Python dictionaries) just fine, so that
shouldn't be an issue:

https://docs.python.org/3/library/json.html

> I am including the json file here.
> 
> I was struck by this a while ago. Please help me to resolve this.
> 

What have you done so far and where exactly are you facing issues?

Also, how is this related to Django?

Kind regards,

Kasper Laudrup

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a473aa95-8366-0834-1900-03946506b9bb%40stacktrace.dk.

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to