Applying OSDParser.DeserializeJson on a json-serialized OSDArray returns empty array.

Description

I used OSDParser.SerializeJsonString() to seralize an OSDArray on the sender side. On the receiver side, the array was derialized and casted back to OSDArray, but was found to be an empty array. It happens even no matter is the serialized data is sent through wire or not. A simple program that can reproduce the problem is attached.

Steps to Reproduce

The following program could be used to reproduce the problem. After the line of "OSD buffer = OSDParser.DeserializeJson(respString);" and casting it into an OSDArray, the array is empty. This piece of code used to work well (with older openmetaverse dlls).

using System;
using System.Collections;

using OpenMetaverse;
using OpenMetaverse.Packets;
using OpenMetaverse.StructuredData;

public class OSDTest
{

public static void Main(string[] args)
{
OSDArray simProfileArray = new OSDArray();

//first, we add the load status and CPU information
OSD loadStatus = OSD.FromUInteger(1);
simProfileArray.Add(loadStatus);
OSD cpu = OSD.FromReal(10.0);
simProfileArray.Add(cpu);

OSDMap statsMap = new OSDMap();
string key = "PrimCount";
float avg = Convert.ToSingle(1.2);
statsMap[key] = OSD.FromReal(avg);
simProfileArray.Add(statsMap);

string respString = OSDParser.SerializeJsonString(simProfileArray);

OSD buffer = OSDParser.DeserializeJson(respString);
OSDArray array;
if (buffer.Type == OSDType.Array)
{
array = (OSDArray)buffer;
}
}
}

Assignee

Unassigned

Reporter

H. Kitty Liu

Severity

Medium

Environment

.NET / Windows32

Fixed in Revision

None

Components

Affects versions

Priority

Major
Configure