Parsing python dictionary in Java using JPython

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sandip desale

    #1

    Parsing python dictionary in Java using JPython

    Dear All,

    I have a python dictionary file. I want to create a map of that dictionary and want to use the same in my Java Program.
    Can anybody please tell me how to use the same python dictionary in Java aswell as in Python.

    Thanks in advance...

    Regards,
    Sandip

    --
    India.com free e-mail - www.india.com.
    Check out our value-added Premium features, such as an extra 20MB for mail storage, POP3, e-mail forwarding, and ads-free mailboxes!
  • Ant

    #2
    Re: Parsing python dictionary in Java using JPython

    It really depends on how you are trying to pass the dictionary across
    to Java, what sort of objects are in the dictionary etc. Could you
    provide some more background?

    BTW the Java implementation of Python is now called Jython (and has
    been for some years!).

    Comment

    • Ravi Teja

      #3
      Re: Parsing python dictionary in Java using JPython

      > I have a python dictionary file. I want to create a map of that dictionary and want to use the same in my Java Program.[color=blue]
      > Can anybody please tell me how to use the same python dictionary in Java as well as in Python.[/color]

      Try a JSON parser for Java







      Comment

      • Ant

        #4
        Re: Parsing python dictionary in Java using JPython

        This will work fine in simple cases and if the dictionaries are passed
        around in repr() form.

        If they are being passed pickled in some way, or the values in the
        dictionary are anything other than strings, lists, dictionaries or
        combinations of these then you will need something like Jython.

        Comment

        Working...