Initial Commit

master
Harald Wolff 2017-10-26 16:41:14 +02:00
commit a9a37de231
17 changed files with 1122 additions and 0 deletions

2
.gitignore vendored 100644
View File

@ -0,0 +1,2 @@
obj
bin

274
ByteParser.cs 100644
View File

@ -0,0 +1,274 @@
using System;
using System.Text;
using System.Collections.Generic;
using sharp.extensions;
namespace sharp.json
{
public class ByteParser
{
private static ASCIIEncoding encoding = new ASCIIEncoding();
static System.Tuple<char,char>[] escapeCharacters = {
System.Tuple.Create('\\','\\'),
System.Tuple.Create('/','/'),
System.Tuple.Create('"','"'),
System.Tuple.Create('b','\b'),
System.Tuple.Create('f','\f'),
System.Tuple.Create('n','\n'),
System.Tuple.Create('r','\r'),
System.Tuple.Create('t','\t'),
};
char[] buffer;
int position;
public ByteParser(string source)
{
this.buffer = source.ToCharArray();
this.position = 0;
}
public char Peek(){
//if (position >= buffer.Length){
// return 0;
//}
return buffer[position];
}
public string Peek(int len){
return new String(buffer.Segment(position,len));
}
public char Read(){
if (position < buffer.Length){
return buffer[position++];
}
throw new Exception("End of buffer reached. No more characters available!");
}
public char[] Read(int len){
if ((position) < buffer.Length){
char[] r = buffer.Segment(position,len);
position += r.Length;
return r;
}
throw new Exception("End of buffer reached. No more characters available!");
}
private Int64 parseInt64(){
Int64 t = 0;
char ch = Read();
bool neg = false;
if (ch == '-'){
neg = true;
ch = Read();
}
if (!ch.isDigit()){
throw new FormatException("JSON: Number format error");
}
while (true){
t *= 10;
t += (int)(ch - '0');
if (!Peek().isDigit()){
break;
}
ch = Read();
}
if (neg){
t *= -1;
}
return t;
}
public JSON parseNumber(){
Int64 i64 = parseInt64();
if (Peek() == '.'){
Read();
Int64 dec = parseInt64();
int lg10 = (int)Math.Log10(dec);
i64 = i64 * lg10;
if (i64 < 0){
i64 -= dec;
} else {
i64 += dec;
}
return new JSONNumber(((double)i64) / (double)lg10 );
} else {
return new JSONNumber(i64);
}
}
public JSON parseObject(){
if (Read() != '{'){
throw new FormatException("parser error: JSON Object should begin with '{'");
}
JSONObject o = new JSONObject();
scanWhitespace();
if (Peek() == '}'){
return o;
} else {
while (true){
string name = parseStringInternal();
scanWhitespace();
if (Read() != ':'){
throw new FormatException(String.Format("parser error: expected ':' but got '{0}'",buffer[position-1]));
}
scanWhitespace();
o[name] = parseValue();
scanWhitespace();
char n = Read();
if (n == '}'){
break;
}
if (n == ','){
scanWhitespace();
continue;
}
throw new FormatException("parser error: expected ',' or '}' but got '{0}'");
}
}
return o;
}
public JSON parseArray(){
if (Read() != '['){
throw new FormatException("parser error: JSON array should begin with '['");
}
JSONArray o = new JSONArray();
scanWhitespace();
if (Peek() == ']'){
return o;
} else {
while (true){
o.Add(parseValue());
scanWhitespace();
char n = Read();
if (n == ']'){
break;
}
if (n == ','){
scanWhitespace();
continue;
}
throw new FormatException(String.Format("parser error: expected ',' or ']' but got '{0}'",n));
}
}
return o;
}
private string parseStringInternal(){
StringBuilder sb = new StringBuilder();
if (Read() != '"'){
throw new FormatException(String.Format("JSON string must start with '\"' but got '{0}'",buffer[position-1]));
}
while (Peek() != '"'){
char ch = Read();
if (ch == '\\'){
ch = Read();
foreach (System.Tuple<char,char> repl in escapeCharacters){
if (repl.Item1 == ch){
sb.Append(repl.Item2);
break;
}
}
if (ch == 'u'){
char[] hex = Read(4);
sb.Append("_");
Console.WriteLine("JSON WARNING: UNICODE ESCAPE SEQUENCES ARE NOT IMPLEMENTED YET");
}
} else {
sb.Append(ch);
}
}
Read();
return sb.ToString();
}
public JSON parseString(){
return new JSONString(parseStringInternal());
}
public JSON parseValue(){
scanWhitespace();
char peek = Peek();
switch (peek){
case '{':
return parseObject();
case '[':
return parseArray();
case '"':
return parseString();
}
if ((peek >= '0' && peek <= '9') || (peek == '-')){
return parseNumber();
}
String p = Peek(4).ToLower();
if (p.Equals("true")){
position+=4;
return JSONSpecial.True;
}
if (p.Equals("null")){
position+=4;
return JSONSpecial.Null;
}
p = Peek(5).ToLower();
if (p.Equals("false")){
position+=5;
return JSONSpecial.False;
}
throw new FormatException(String.Format("Could not parse source at character '{0}' at position {1}",Peek(),position));
}
public JSON parse(){
return parseValue();
}
private int findNext(char c){
int p = position;
while (p < buffer.Length){
if (buffer[p] == c){
return p - position;
}
}
return -1;
}
private int scanWhitespace(){
while (position < buffer.Length){
if (buffer[position] > 0x20){
return position;
}
position++;
}
return position;
}
}
}

67
JSON.cs 100644
View File

@ -0,0 +1,67 @@
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
namespace sharp.json
{
public abstract class JSON
{
List<string> keys = new List<string>();
List<JSON> values = new List<JSON>();
public JSON this[int n] {
get {
return values[n];
}
set{
values[n] = value;
}
}
public JSON this[string name] {
get {
return values[keys.IndexOf(name)];
}
set{
if (keys.Contains(name)){
values[keys.IndexOf(name)] = value;
} else {
keys.Add(name);
values.Add(value);
}
}
}
public string[] Keys {
get { return this.keys.ToArray(); }
}
public JSON[] Values {
get { return this.values.ToArray(); }
}
public void Add(JSON element){
this.values.Add(element);
}
public virtual bool isTrue(){
return this.JSONType == JSONTypes.True;
}
public int Count { get { return values.Count; } }
public JSONTypes JSONType { get; private set; }
protected JSON(JSONTypes type){
JSONType = type;
}
public abstract string prettyPrint(int d);
public override abstract string ToString();
public static JSON parse(String jsonSource){
return new ByteParser(jsonSource).parse();
}
}
}

37
JSONArray.cs 100644
View File

@ -0,0 +1,37 @@
using System;
using System.Text;
using System.Collections.Generic;
namespace sharp.json
{
public class JSONArray : JSON
{
public JSONArray()
:base(JSONTypes.Array){}
public override bool isTrue()
{
throw new NotImplementedException();
}
public override string prettyPrint(int d = 0)
{
return ToString();
}
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("[");
for (int n=0;n<this.Count;n++)
{
sb.Append(this[n].ToString());
if (n+1 < this.Count){
sb.Append(",");
}
}
sb.Append("]");
return sb.ToString();
}
}
}

42
JSONNumber.cs 100644
View File

@ -0,0 +1,42 @@
using System;
namespace sharp.json
{
public class JSONNumber: JSON
{
Int64 intValue;
Double doubleValue;
public JSONNumber()
:base(JSONTypes.Number)
{
intValue = 0;
doubleValue = Double.NaN;
}
public JSONNumber(Int64 i)
:base(JSONTypes.Number)
{
intValue = i;
doubleValue = Double.NaN;
}
public JSONNumber(Double d)
:base(JSONTypes.Number)
{
intValue = (Int64)d;
doubleValue = d;
}
public override string prettyPrint(int d = 0)
{
if (Double.IsNaN(doubleValue)){
return this.intValue.ToString();
} else {
return this.doubleValue.ToString();
}
}
public override string ToString()
{
return this.prettyPrint(0);
}
}
}

58
JSONObject.cs 100644
View File

@ -0,0 +1,58 @@
using System;
using System.Text;
using System.Collections.Generic;
namespace sharp.json
{
public class JSONObject : JSON
{
public JSONObject()
:base(JSONTypes.Object){}
public override bool isTrue()
{
throw new NotImplementedException();
}
public override string prettyPrint(int d = 0)
{
StringBuilder sb = new StringBuilder();
sb.Append("{");
string[] keys = Keys;
for (int n=0;n<keys.Length;n++)
{
sb.Append(new JSONString(keys[n]));
sb.Append(":");
sb.Append(this[keys[n]].ToString());
if (n+1 < keys.Length){
sb.Append(",");
}
}
sb.Append("}");
return sb.ToString();
}
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("{");
string[] keys = Keys;
for (int n=0;n<keys.Length;n++)
{
sb.Append(new JSONString(keys[n]));
sb.Append(":");
sb.Append(this[keys[n]].ToString());
if (n+1 < keys.Length){
sb.Append(",");
}
}
sb.Append("}");
return sb.ToString();
}
}
}

38
JSONSpecial.cs 100644
View File

@ -0,0 +1,38 @@
using System;
namespace sharp.json
{
public class JSONSpecial: JSON
{
public static readonly JSON True = new JSONSpecial(JSONTypes.True);
public static readonly JSON False = new JSONSpecial(JSONTypes.False);
public static readonly JSON Null = new JSONSpecial(JSONTypes.Null);
private JSONSpecial(JSONTypes type)
:base(type)
{
}
public override bool isTrue()
{
return (JSONType == JSONTypes.True);
}
public override string prettyPrint(int d = 0)
{
switch (JSONType){
case JSONTypes.Null:
return "null";
case JSONTypes.True:
return "true";
case JSONTypes.False:
return "false";
}
throw new NotImplementedException("JSON Special Type badly wrong....");
}
public override string ToString()
{
return prettyPrint();
}
}
}

66
JSONString.cs 100644
View File

@ -0,0 +1,66 @@
using System;
using System.Text;
namespace sharp.json
{
public class JSONString : JSON
{
static System.Tuple<char,char>[] escapeCharacters = {
System.Tuple.Create('\\','\\'),
System.Tuple.Create('/','/'),
System.Tuple.Create('"','"'),
System.Tuple.Create('b','\b'),
System.Tuple.Create('f','\f'),
System.Tuple.Create('n','\n'),
System.Tuple.Create('r','\r'),
System.Tuple.Create('t','\t'),
};
string value;
public JSONString()
:base(JSONTypes.String)
{
this.value = "";
}
public JSONString(String value)
:base(JSONTypes.String)
{
this.value = value;
}
public override string prettyPrint(int d = 0)
{
return string.Format("\"{0}\"",escape(value));
}
public override string ToString()
{
return prettyPrint();
}
public static string escape(string source){
StringBuilder sb = new StringBuilder();
foreach (char ch in source){
if ((ch >= 0x20) && (ch < 128)){
sb.Append(ch);
} else if (ch < 0x20){
foreach (Tuple<char,char> repl in escapeCharacters){
if (repl.Item2 == ch){
sb.Append("\\");
sb.Append(repl.Item1);
break;
}
}
} else {
int iv = (int)ch;
sb.Append("\\u");
sb.Append("____");
Console.WriteLine("JSON WARNING: UNICODE ESCAPE SEQUENCES ARE NOT IMPLEMENTED YET");
}
}
return sb.ToString();
}
}
}

8
JSONTypes.cs 100644
View File

@ -0,0 +1,8 @@
using System;
namespace sharp.json
{
public enum JSONTypes
{
Null, True, False, Object, Array, String, Number
}
}

View File

@ -0,0 +1,26 @@
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("sharp.json")]
[assembly: AssemblyDescription("JSON Implementation")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

View File

@ -0,0 +1,40 @@
using System;
using System.IO;
using sharp.json;
namespace json.test
{
class MainClass
{
static string[] sources = {
"\"I am a string\"",
"{ \"me\" : \"is a string too\"}",
"[ \"this\", \"is\", \"an\", \"array\" ]"
};
public static void Main(string[] args)
{
JSON json;
Console.WriteLine("JSON test Patterns:");
Console.WriteLine();
foreach (string src in sources){
json = JSON.parse(src);
Console.WriteLine("SOURCE: {0}",src);
Console.WriteLine("PARSED: {0}",json.ToString());
Console.WriteLine("REPARSED: {0}",JSON.parse(json.ToString()).ToString());
}
json = JSON.parse(File.ReadAllText("test.json"));
Console.WriteLine("");
Console.WriteLine("test.json file:");
Console.WriteLine("PARSED: {0}",json.ToString());
}
}
}

View File

@ -0,0 +1,26 @@
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("json.test")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{49FFBD9F-655E-4C74-A078-99B5E09059C6}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>json.test</RootNamespace>
<AssemblyName>json.test</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ExternalConsole>true</ExternalConsole>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ExternalConsole>true</ExternalConsole>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\sharp.json.csproj">
<Project>{D9342117-3249-4D8B-87C9-51A50676B158}</Project>
<Name>sharp.json</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="test.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(RunConfiguration)' == 'Default' ">
<StartAction>Project</StartAction>
<ExternalConsole>false</ExternalConsole>
</PropertyGroup>
</Project>

317
json.test/test.json 100644
View File

@ -0,0 +1,317 @@
[
{
"_id": "59f1e59e0f93b5501585651d",
"index": 0,
"guid": "e88f3f2a-3253-4137-9169-b4410c2b806e",
"isActive": true,
"balance": "$2,448.63",
"picture": "http://placehold.it/32x32",
"age": 20,
"eyeColor": "green",
"name": "Kim Trevino",
"gender": "female",
"company": "FROSNEX",
"email": "kimtrevino@frosnex.com",
"phone": "+1 (828) 501-2822",
"address": "309 Forrest Street, Waiohinu, Mississippi, 4324",
"about": "Excepteur sit veniam consequat nostrud minim quis enim aliqua est eiusmod laboris culpa. Eiusmod duis culpa dolor excepteur voluptate ullamco et. Laborum nostrud amet magna in anim qui ad exercitation velit nostrud. Magna est voluptate mollit ipsum incididunt officia.\r\n",
"registered": "2016-04-22T11:29:02 -02:00",
"latitude": 63.703284,
"longitude": 155.700614,
"tags": [
"quis",
"Lorem",
"dolor",
"do",
"nisi",
"cupidatat",
"dolor"
],
"friends": [
{
"id": 0,
"name": "Baird Hubbard"
},
{
"id": 1,
"name": "Marie Strong"
},
{
"id": 2,
"name": "Millie Armstrong"
}
],
"greeting": "Hello, Kim Trevino! You have 5 unread messages.",
"favoriteFruit": "strawberry"
},
{
"_id": "59f1e59e5ccd12f718d4abef",
"index": 1,
"guid": "4d89ade0-1061-4f5f-8a1f-32146e1fe346",
"isActive": true,
"balance": "$3,468.56",
"picture": "http://placehold.it/32x32",
"age": 22,
"eyeColor": "blue",
"name": "Cote Case",
"gender": "male",
"company": "GEEKNET",
"email": "cotecase@geeknet.com",
"phone": "+1 (805) 553-3611",
"address": "251 Highlawn Avenue, Berwind, Kentucky, 7590",
"about": "Consectetur quis Lorem ut duis sunt Lorem reprehenderit dolore proident ullamco qui irure veniam cupidatat. Non deserunt adipisicing occaecat est culpa fugiat pariatur nostrud est officia esse proident culpa. Anim velit dolore pariatur adipisicing sint ullamco dolor enim voluptate excepteur eu do laboris do. Voluptate nostrud ullamco sit labore. Ad do commodo amet aliquip laboris sit irure qui aliqua dolore labore.\r\n",
"registered": "2016-08-03T04:34:48 -02:00",
"latitude": 28.463579,
"longitude": 35.373716,
"tags": [
"quis",
"irure",
"qui",
"officia",
"aliquip",
"amet",
"est"
],
"friends": [
{
"id": 0,
"name": "Johanna Larsen"
},
{
"id": 1,
"name": "Richmond Ward"
},
{
"id": 2,
"name": "Dominique Ramirez"
}
],
"greeting": "Hello, Cote Case! You have 5 unread messages.",
"favoriteFruit": "strawberry"
},
{
"_id": "59f1e59e1572c7a9c1da5405",
"index": 2,
"guid": "ab370e92-a65d-47a2-bd7b-dec38a80ee09",
"isActive": false,
"balance": "$1,297.48",
"picture": "http://placehold.it/32x32",
"age": 37,
"eyeColor": "green",
"name": "Haley Brewer",
"gender": "male",
"company": "ZILLAR",
"email": "haleybrewer@zillar.com",
"phone": "+1 (843) 583-2641",
"address": "496 Emmons Avenue, Enetai, Arizona, 7650",
"about": "Do velit et adipisicing do aute exercitation quis incididunt duis ad aliquip aliqua excepteur. Veniam fugiat ipsum do magna anim ad dolor. Ex sunt aliquip amet ea occaecat nisi quis in do eiusmod ex sit deserunt. Est exercitation do ex cupidatat tempor voluptate ut Lorem consequat. Aliquip non sunt nostrud veniam. Sit in in fugiat eu magna exercitation irure cillum labore.\r\n",
"registered": "2016-05-01T06:57:55 -02:00",
"latitude": -42.360466,
"longitude": -60.960653,
"tags": [
"eiusmod",
"sint",
"pariatur",
"do",
"ullamco",
"cupidatat",
"id"
],
"friends": [
{
"id": 0,
"name": "Jenny Horne"
},
{
"id": 1,
"name": "Minnie Leach"
},
{
"id": 2,
"name": "Guthrie Maxwell"
}
],
"greeting": "Hello, Haley Brewer! You have 8 unread messages.",
"favoriteFruit": "apple"
},
{
"_id": "59f1e59e7b95bc5299c9f2d1",
"index": 3,
"guid": "b46a8b03-8417-44d2-a54b-5646bd0d281c",
"isActive": true,
"balance": "$3,264.43",
"picture": "http://placehold.it/32x32",
"age": 33,
"eyeColor": "blue",
"name": "Snow Shaffer",
"gender": "male",
"company": "SNOWPOKE",
"email": "snowshaffer@snowpoke.com",
"phone": "+1 (828) 473-3114",
"address": "992 Dearborn Court, Logan, Federated States Of Micronesia, 6556",
"about": "Laborum aliquip aute pariatur cupidatat pariatur ea. Et mollit consequat nulla ullamco non officia pariatur ex incididunt sunt adipisicing reprehenderit velit. Ullamco non laborum elit fugiat. Sint cillum voluptate ullamco fugiat reprehenderit qui mollit velit. Aliqua aliquip elit aliquip Lorem veniam pariatur esse cillum nisi officia cillum quis labore.\r\n",
"registered": "2016-03-18T08:16:13 -01:00",
"latitude": -64.030865,
"longitude": -88.34457,
"tags": [
"magna",
"proident",
"magna",
"excepteur",
"non",
"et",
"sit"
],
"friends": [
{
"id": 0,
"name": "Lawson Brennan"
},
{
"id": 1,
"name": "Daniels Carson"
},
{
"id": 2,
"name": "Horn Hood"
}
],
"greeting": "Hello, Snow Shaffer! You have 2 unread messages.",
"favoriteFruit": "apple"
},
{
"_id": "59f1e59e0db09a4c480e75d6",
"index": 4,
"guid": "c7cf2208-9e20-4e9f-b670-2cdb74d7699a",
"isActive": false,
"balance": "$2,175.68",
"picture": "http://placehold.it/32x32",
"age": 35,
"eyeColor": "green",
"name": "Kramer Pollard",
"gender": "male",
"company": "DOGNOSIS",
"email": "kramerpollard@dognosis.com",
"phone": "+1 (934) 580-2560",
"address": "732 Folsom Place, Whitehaven, Maryland, 8572",
"about": "Ad minim laboris officia quis. Anim nulla et adipisicing sit est cupidatat ex nostrud ullamco mollit aute. Ipsum qui sunt enim quis adipisicing id ea cillum nulla. Adipisicing elit dolore veniam eu sint aliqua non ea adipisicing. Nulla Lorem nulla pariatur amet exercitation magna labore ea. Labore commodo in cupidatat minim cupidatat.\r\n",
"registered": "2015-02-07T09:09:00 -01:00",
"latitude": 83.970257,
"longitude": -114.00038,
"tags": [
"laboris",
"aliquip",
"ea",
"sint",
"dolor",
"veniam",
"est"
],
"friends": [
{
"id": 0,
"name": "Kinney Owen"
},
{
"id": 1,
"name": "Hess Reese"
},
{
"id": 2,
"name": "Morse Hurley"
}
],
"greeting": "Hello, Kramer Pollard! You have 6 unread messages.",
"favoriteFruit": "strawberry"
},
{
"_id": "59f1e59edb953c54accaa548",
"index": 5,
"guid": "be93d4ca-347b-4c97-9433-99b5cfd12e16",
"isActive": true,
"balance": "$2,725.10",
"picture": "http://placehold.it/32x32",
"age": 22,
"eyeColor": "green",
"name": "Turner Robinson",
"gender": "male",
"company": "FIREWAX",
"email": "turnerrobinson@firewax.com",
"phone": "+1 (949) 533-3924",
"address": "331 Throop Avenue, Brady, Ohio, 919",
"about": "Id exercitation aute elit in duis laboris dolore. Occaecat nulla amet elit pariatur ipsum culpa mollit ad Lorem mollit. Magna ex labore elit do deserunt deserunt laboris ipsum. Est nostrud qui nulla adipisicing Lorem enim occaecat excepteur sint id quis dolor minim enim. Adipisicing consequat ut ad sint sunt enim. Laborum sint officia pariatur ea non dolor aliquip officia veniam qui minim velit ea nostrud. Amet dolore cupidatat velit laboris fugiat aute veniam sint aliqua fugiat nostrud anim incididunt et.\r\n",
"registered": "2015-08-21T07:41:31 -02:00",
"latitude": -51.608905,
"longitude": -169.745012,
"tags": [
"amet",
"laborum",
"esse",
"nulla",
"tempor",
"nisi",
"cillum"
],
"friends": [
{
"id": 0,
"name": "Gina Holden"
},
{
"id": 1,
"name": "Kane Wolf"
},
{
"id": 2,
"name": "Dorsey Pate"
}
],
"greeting": "Hello, Turner Robinson! You have 3 unread messages.",
"favoriteFruit": "apple"
},
{
"_id": "59f1e59e9891229ca4cc0322",
"index": 6,
"guid": "1b7258b3-dd5d-4dc6-a7ee-1c5398d2b442",
"isActive": true,
"balance": "$1,060.29",
"picture": "http://placehold.it/32x32",
"age": 20,
"eyeColor": "blue",
"name": "Byers Rojas",
"gender": "male",
"company": "CHORIZON",
"email": "byersrojas@chorizon.com",
"phone": "+1 (804) 553-3001",
"address": "598 McKinley Avenue, Roosevelt, American Samoa, 6741",
"about": "Sunt ullamco mollit et dolore ut. Et aliquip ipsum laboris id et nulla ipsum consequat adipisicing. Eiusmod enim ad sunt nisi nulla sit Lorem pariatur.\r\n",
"registered": "2016-08-27T09:48:41 -02:00",
"latitude": -48.874859,
"longitude": 73.09912,
"tags": [
"voluptate",
"esse",
"sunt",
"do",
"aute",
"laborum",
"deserunt"
],
"friends": [
{
"id": 0,
"name": "Rosanne Benjamin"
},
{
"id": 1,
"name": "Beach Doyle"
},
{
"id": 2,
"name": "Ella Collier"
}
],
"greeting": "Hello, Byers Rojas! You have 9 unread messages.",
"favoriteFruit": "apple"
}
]

59
sharp.json.csproj 100644
View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D9342117-3249-4D8B-87C9-51A50676B158}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>sharp.json</RootNamespace>
<AssemblyName>sharp.json</AssemblyName>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="JSON.cs" />
<Compile Include="ByteParser.cs" />
<Compile Include="JSONSpecial.cs" />
<Compile Include="JSONObject.cs" />
<Compile Include="JSONArray.cs" />
<Compile Include="JSONString.cs" />
<Compile Include="JSONTypes.cs" />
<Compile Include="JSONNumber.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\sharp-extensions\sharp.extensions.csproj">
<Project>{97CA3CA9-98B3-4492-B072-D7A5995B68E9}</Project>
<Name>sharp.extensions</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<MonoDevelop>
<Properties>
<Policies>
<DotNetNamingPolicy DirectoryNamespaceAssociation="PrefixedHierarchical" ResourceNamePolicy="FileFormatDefault" />
</Policies>
</Properties>
</MonoDevelop>
</ProjectExtensions>
</Project>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(RunConfiguration)' == 'Default' ">
<StartAction>Project</StartAction>
<ConsolePause>true</ConsolePause>
</PropertyGroup>
</Project>