Questions tagged [jsonpickle]

jsonpickle is a Python library for serialization and deserialization of complex Python objects to and from JSON.

jsonpickle is a Python library for serialization and deserialization of complex Python objects to and from JSON. The standard Python libraries for encoding Python into JSON, such as the stdlib’s json, simplejson, and demjson, can only handle Python primitives that have a direct JSON equivalent (e.g. dicts, lists, strings, ints, etc.). jsonpickle builds on top of these libraries and allows more complex data structures to be serialized to JSON. jsonpickle is highly configurable and extendable–allowing the user to choose the JSON backend and add additional backends.

93 questions
0
votes
0 answers

The behavior of the jsonpickle module is different when I run my code in the CMD compared to when I run it in a Jupyter notebook

the goal of my still very simple code is to read in a logfile and store it in a dictionary. My logfile looks like this: Picture of my logfile Here you can see the code of my class LogfileHandler. This class simply takes a path where the logfile is…
0
votes
0 answers

How to decode a jsonpickle file in python?

I am making a D&D text-based game and wanted to make a save progress function where python would save a particular function that I made (such as episode 01) and would load the progress when user calls it. I am trying to use jsonpickle to do so, but…
0
votes
2 answers

How to decode Complex data(in Vue js 3) encoded by jsonpickle(python flask)

I am using python Flask as Backend and vue 3 as frontend. I have ndarray of some complex number that I need to send to vue 3. json is not accepting Complex values so I tried jsonpickle method to encode it. I am able to receive Jsonpickle object to…
0
votes
2 answers

Writing a JSON file from dictionary, correcting the output

So I am working on a conversion file that is taking a dictionary and converting it to a JSON file. Current code looks like: data = {json_object} json_string = jsonpickle.encode(data) with open('/Users/machd/Mac/Documents/VISUAL CODE/CSV_to_JSON/JSON…
0
votes
1 answer

pickledb appending list to python

For a Course Site (created using flask), I have created a json database which I am accessing using pickleDB in main.py. Here is how my course.json looks like: { "Course A": {"Student1": { "grade":"", "distribution":"", …
0
votes
2 answers

Python Array Issue with jsonpickle

I have some values here. Printing the array shows the values just fine. However conducting Jsonpickle shows something about numpy and py/tuple items. Have no idea why, and attempted to cleare cache and rebuild. That did not solve the issue. Anyone…
mattsmith5
  • 540
  • 4
  • 29
  • 67
0
votes
1 answer

Python: unable to print the same object twice or more using jsonpickle

In a fairly complex project I came up with this issue at some point, where nested objects should be printed and the same objects have to exist there twice or more. Here I provide a simplified version of the code to reproduce the issue: import…
Pharaoh
  • 13
  • 3
0
votes
1 answer

Jsonpickle in subclass changes data type

In one of my projects I have a strange problem with jsonpickle, as long as I run it from the same file it works fine, but if it is run from a other class it changes the target object to dict. Below is simple problem reconstruction. My original…
parasit
  • 486
  • 1
  • 4
  • 10
0
votes
0 answers

Convert pkl file to json file

I'm new on stack-overflow. I'm trying to convert pkl file into json file using python. Below is my sample code import pickle import pandas as pd # Load pickle file input_file = open('file.pkl', 'rb') new_dict =…
Erric
  • 123
  • 1
  • 10
0
votes
1 answer

How to serialize ObjectId with jsonpickle in flask pymongo

I'm using Flask with MongoDB as a database and pymongo as a driver. I have a trouble serializing object into JSON with json.dumps(), json.loads(), json_util.dumps() and many more as it always says TypeError: Object of type 'EachRoom' is not JSON…
Vicky Sultan
  • 73
  • 2
  • 15
0
votes
0 answers

JSON-Pickle returns own iterator class as list iterator rather than itself

I want to encode a Python class that is iterable as a JSON however JSON-Pickle returns it as just a list generator when decoding. This my code: from typing import Iterable from Helper import Helper from RCEnum import RCEnum import jsonpickle class…
0
votes
1 answer

Implementing iterable for jsonpickle decoded twice

When I encode and decode a custom iterable class with jsonpickle, the contained items are doubled. I tried to use demjson and simplejson and I tried to implement this https://docs.python.org/2.5/ref/sequence-types.html. If I inherit from list it…
Joerg
  • 3
  • 3
0
votes
0 answers

jsonpickle.decode() not executing in Flask

I've got a Flask app run with Apache that uses some custom object that's serialized with jsonpickle. When deserializing with jsonpickle.decode(my_json_string), there's nothing happening, meaning the method does not return anything nor does it throw…
Joko
  • 166
  • 3
  • 17
0
votes
1 answer

Runtime.ImportModuleError: Unable to import module 'testsdk': No module named 'jsonpickle' with Python script using AWS Lambda

My Python script has been tested on multiple local computers and works as expected. But when the script is zipped up and uploaded to AWS Lambda I get Runtime.ImportModuleError: Unable to import module 'testsdk': No module named 'jsonpickle' when I…
0
votes
1 answer

Scenario safe for pickling in Python

I'm aware that there are potentially severe security implications to pickling/unpickling. I was planning to use pickling as a way to store and transfer an object instance in a Django model using jsonpickle. I was also going to use a hash or…
Brian
  • 642
  • 7
  • 18